Commit 44f50820 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '1.2.x'

parents e33221aa 58ebfdcb
......@@ -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 {
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;
}
......
......@@ -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 {
/**
* 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.
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment