diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index 3417e4f34a..ede344090e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -48,6 +48,7 @@ import org.springframework.util.Assert; * * @author Dave Syer * @author Phillip Webb + * @author Jacques-Etienne Beaudet * @since 1.1.0 */ @Configuration @@ -114,8 +115,9 @@ public class FlywayAutoConfiguration { else { flyway.setDataSource(this.dataSource); } - //Explicitly set locations because the getter doesn't return a mutable value + // TODO: remove this line once SPR-13749 is fixed flyway.setLocations(this.properties.getLocations().toArray(new String[0])); + return flyway; } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index 47cfe3907f..0a5f137a6c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -104,7 +104,20 @@ public class FlywayAutoConfigurationTests { @Test public void overrideLocations() throws Exception { - EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations[0]:classpath:db/changelog", + EnvironmentTestUtils.addEnvironment(this.context, + "flyway.locations:classpath:db/changelog,classpath:db/migration"); + registerAndRefresh(EmbeddedDataSourceConfiguration.class, + FlywayAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + Flyway flyway = this.context.getBean(Flyway.class); + assertEquals("[classpath:db/changelog, classpath:db/migration]", + Arrays.asList(flyway.getLocations()).toString()); + } + + @Test + public void overrideLocationsList() throws Exception { + EnvironmentTestUtils.addEnvironment(this.context, + "flyway.locations[0]:classpath:db/changelog", "flyway.locations[1]:classpath:db/migration"); registerAndRefresh(EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class,