Skip to content

Commit 44f5082

Browse files
committed
Merge branch '1.2.x'
2 parents e33221a + 58ebfdc commit 44f5082

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
* @author Phillip Webb
5959
* @author Vedran Pavic
6060
* @author Stephane Nicoll
61+
* @author Jacques-Etienne Beaudet
6162
* @since 1.1.0
6263
*/
6364
@Configuration
@@ -132,6 +133,9 @@ else if (this.flywayDataSource != null) {
132133
else {
133134
flyway.setDataSource(this.dataSource);
134135
}
136+
// TODO: remove this line once SPR-13749 is fixed
137+
flyway.setLocations(this.properties.getLocations().toArray(new String[0]));
138+
135139
return flyway;
136140
}
137141

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.boot.autoconfigure.flyway;
1818

19+
import java.util.ArrayList;
1920
import java.util.Arrays;
2021
import java.util.Collections;
2122
import java.util.List;
@@ -39,7 +40,7 @@ public class FlywayProperties {
3940
/**
4041
* Locations of migrations scripts.
4142
*/
42-
private List<String> locations = Arrays.asList("db/migration");
43+
private List<String> locations = new ArrayList<String>(Arrays.asList("db/migration"));
4344

4445
/**
4546
* Check that migration scripts location exists.

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ public void overrideLocations() throws Exception {
130130
Arrays.asList(flyway.getLocations()).toString());
131131
}
132132

133+
@Test
134+
public void overrideLocationsList() throws Exception {
135+
EnvironmentTestUtils.addEnvironment(this.context,
136+
"flyway.locations[0]:classpath:db/changelog",
137+
"flyway.locations[1]:classpath:db/migration");
138+
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
139+
FlywayAutoConfiguration.class,
140+
PropertyPlaceholderAutoConfiguration.class);
141+
Flyway flyway = this.context.getBean(Flyway.class);
142+
assertEquals("[classpath:db/changelog, classpath:db/migration]",
143+
Arrays.asList(flyway.getLocations()).toString());
144+
}
145+
133146
@Test
134147
public void overrideSchemas() throws Exception {
135148
EnvironmentTestUtils.addEnvironment(this.context, "flyway.schemas:public");

0 commit comments

Comments
 (0)