Skip to content

Commit 58ebfdc

Browse files
committed
Polish contribution
Closes spring-projectsgh-4973
1 parent a749855 commit 58ebfdc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
*
4949
* @author Dave Syer
5050
* @author Phillip Webb
51+
* @author Jacques-Etienne Beaudet
5152
* @since 1.1.0
5253
*/
5354
@Configuration
@@ -114,8 +115,9 @@ else if (this.flywayDataSource != null) {
114115
else {
115116
flyway.setDataSource(this.dataSource);
116117
}
117-
//Explicitly set locations because the getter doesn't return a mutable value
118+
// TODO: remove this line once SPR-13749 is fixed
118119
flyway.setLocations(this.properties.getLocations().toArray(new String[0]));
120+
119121
return flyway;
120122
}
121123

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,20 @@ public void defaultFlyway() throws Exception {
104104

105105
@Test
106106
public void overrideLocations() throws Exception {
107-
EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations[0]:classpath:db/changelog",
107+
EnvironmentTestUtils.addEnvironment(this.context,
108+
"flyway.locations:classpath:db/changelog,classpath:db/migration");
109+
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
110+
FlywayAutoConfiguration.class,
111+
PropertyPlaceholderAutoConfiguration.class);
112+
Flyway flyway = this.context.getBean(Flyway.class);
113+
assertEquals("[classpath:db/changelog, classpath:db/migration]",
114+
Arrays.asList(flyway.getLocations()).toString());
115+
}
116+
117+
@Test
118+
public void overrideLocationsList() throws Exception {
119+
EnvironmentTestUtils.addEnvironment(this.context,
120+
"flyway.locations[0]:classpath:db/changelog",
108121
"flyway.locations[1]:classpath:db/migration");
109122
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
110123
FlywayAutoConfiguration.class,

0 commit comments

Comments
 (0)