Browse Source

Polish contribution

Closes gh-4973
1.2.x
Stephane Nicoll 10 years ago
parent
commit
58ebfdcbd3
  1. 4
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
  2. 15
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java

4
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java

@ -48,6 +48,7 @@ import org.springframework.util.Assert; @@ -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 { @@ -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;
}

15
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java

@ -104,7 +104,20 @@ public class FlywayAutoConfigurationTests { @@ -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,

Loading…
Cancel
Save