Browse Source

Merge branch '1.2.x'

pull/4854/merge
Stephane Nicoll 10 years ago
parent
commit
44f508208a
  1. 4
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
  2. 3
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java
  3. 13
      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

@ -58,6 +58,7 @@ import org.springframework.util.ObjectUtils; @@ -58,6 +58,7 @@ import org.springframework.util.ObjectUtils;
* @author Phillip Webb
* @author Vedran Pavic
* @author Stephane Nicoll
* @author Jacques-Etienne Beaudet
* @since 1.1.0
*/
@Configuration
@ -132,6 +133,9 @@ public class FlywayAutoConfiguration { @@ -132,6 +133,9 @@ public class FlywayAutoConfiguration {
else {
flyway.setDataSource(this.dataSource);
}
// TODO: remove this line once SPR-13749 is fixed
flyway.setLocations(this.properties.getLocations().toArray(new String[0]));
return flyway;
}

3
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.flyway;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -39,7 +40,7 @@ public class FlywayProperties { @@ -39,7 +40,7 @@ public class FlywayProperties {
/**
* Locations of migrations scripts.
*/
private List<String> locations = Arrays.asList("db/migration");
private List<String> locations = new ArrayList<String>(Arrays.asList("db/migration"));
/**
* Check that migration scripts location exists.

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

@ -130,6 +130,19 @@ public class FlywayAutoConfigurationTests { @@ -130,6 +130,19 @@ public class FlywayAutoConfigurationTests {
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,
PropertyPlaceholderAutoConfiguration.class);
Flyway flyway = this.context.getBean(Flyway.class);
assertEquals("[classpath:db/changelog, classpath:db/migration]",
Arrays.asList(flyway.getLocations()).toString());
}
@Test
public void overrideSchemas() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public");

Loading…
Cancel
Save