Avoid double binding of Flyway's locations

Closes gh-4995
pull/13961/merge
Stephane Nicoll 6 years ago
parent 14b413bf08
commit 8367c57d96

@ -169,10 +169,7 @@ public class FlywayAutoConfiguration {
+ " One type must be used exclusively."); + " One type must be used exclusively.");
} }
} }
String[] locations = new LocationResolver(flyway.getDataSource()) checkLocationExists(flyway);
.resolveLocations(this.properties.getLocations());
checkLocationExists(locations);
flyway.setLocations(locations);
return flyway; return flyway;
} }
@ -182,7 +179,9 @@ public class FlywayAutoConfiguration {
return (value != null) ? value : defaultValue.get(); return (value != null) ? value : defaultValue.get();
} }
private void checkLocationExists(String... locations) { private void checkLocationExists(Flyway flyway) {
String[] locations = new LocationResolver(flyway.getDataSource())
.resolveLocations(this.properties.getLocations());
if (this.properties.isCheckLocation()) { if (this.properties.isCheckLocation()) {
Assert.state(locations.length != 0, Assert.state(locations.length != 0,
"Migration script locations not configured"); "Migration script locations not configured");

Loading…
Cancel
Save