mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Polish contribution
Closes gh-4973
This commit is contained in:
parent
a749855cb5
commit
58ebfdcbd3
@ -48,6 +48,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Phillip Webb
|
||||
* @author Jacques-Etienne Beaudet
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Configuration
|
||||
@ -114,8 +115,9 @@ public class FlywayAutoConfiguration {
|
||||
else {
|
||||
flyway.setDataSource(this.dataSource);
|
||||
}
|
||||
//Explicitly set locations because the getter doesn't return a mutable value
|
||||
// TODO: remove this line once SPR-13749 is fixed
|
||||
flyway.setLocations(this.properties.getLocations().toArray(new String[0]));
|
||||
|
||||
return flyway;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,20 @@ public class FlywayAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void overrideLocations() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "flyway.locations[0]:classpath:db/changelog",
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"flyway.locations:classpath:db/changelog,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 overrideLocationsList() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"flyway.locations[0]:classpath:db/changelog",
|
||||
"flyway.locations[1]:classpath:db/migration");
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
Loading…
Reference in New Issue
Block a user