From 4d97ed19e8391169aa2766a4fa7693b8f9134192 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 9 Mar 2021 15:50:17 +0000 Subject: [PATCH] Deprecate support for checking Flyway locations Closes gh-25488 --- .../autoconfigure/flyway/FlywayAutoConfiguration.java | 1 + .../flyway/FlywayMigrationScriptMissingException.java | 2 ++ .../boot/autoconfigure/flyway/FlywayProperties.java | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index a227d45bdc..596a712ad4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -143,6 +143,7 @@ public class FlywayAutoConfiguration { return configuration.getDataSource(); } + @SuppressWarnings("deprecation") private void checkLocationExists(DataSource dataSource, FlywayProperties properties, ResourceLoader resourceLoader) { if (properties.isCheckLocation()) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayMigrationScriptMissingException.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayMigrationScriptMissingException.java index 4ac622585c..76e5a4a7d6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayMigrationScriptMissingException.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayMigrationScriptMissingException.java @@ -25,7 +25,9 @@ import java.util.List; * @author Anand Shastri * @author Stephane Nicoll * @since 2.2.0 + * @deprecated since 2.5.0 as location checking is deprecated */ +@Deprecated public class FlywayMigrationScriptMissingException extends RuntimeException { private final List locations; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java index 1d4adb8152..9e42caf922 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; /** * Configuration properties for Flyway database migrations. @@ -45,8 +46,10 @@ public class FlywayProperties { private boolean enabled = true; /** - * Whether to check that migration scripts location exists. + * Whether to check that migration scripts location exists. Should be set to false + * when using a wildcard location or a remote-hosted location such as S3 or GCS. */ + @Deprecated private boolean checkLocation = true; /** @@ -365,10 +368,14 @@ public class FlywayProperties { this.enabled = enabled; } + @Deprecated + @DeprecatedConfigurationProperty( + reason = "Locations can no longer be checked accurately due to changes in Flyway's location support.") public boolean isCheckLocation() { return this.checkLocation; } + @Deprecated public void setCheckLocation(boolean checkLocation) { this.checkLocation = checkLocation; }