Merge branch '1.2.x'

pull/4854/merge
Stephane Nicoll 9 years ago
commit 44f508208a

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

@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.flyway; package org.springframework.boot.autoconfigure.flyway;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -39,7 +40,7 @@ public class FlywayProperties {
/** /**
* Locations of migrations scripts. * 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. * Check that migration scripts location exists.

@ -130,6 +130,19 @@ public class FlywayAutoConfigurationTests {
Arrays.asList(flyway.getLocations()).toString()); 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 @Test
public void overrideSchemas() throws Exception { public void overrideSchemas() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public"); EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public");

Loading…
Cancel
Save