From f2ad08c29278e663ae34e1983ccff9b1079b878f Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Tue, 1 Aug 2023 14:38:42 -0500 Subject: [PATCH] Add since version to deprecated config properties See gh-36482 --- .../actuate/autoconfigure/metrics/MetricsProperties.java | 3 ++- .../autoconfigure/metrics/PropertiesMeterFilter.java | 1 + .../metrics/export/otlp/OtlpProperties.java | 4 +++- .../metrics/export/otlp/OtlpPropertiesConfigAdapter.java | 1 + .../export/otlp/OtlpPropertiesConfigAdapterTests.java | 3 +++ .../autoconfigure/couchbase/CouchbaseProperties.java | 6 ++++-- .../boot/autoconfigure/flyway/FlywayProperties.java | 8 ++++---- .../boot/autoconfigure/influx/InfluxDbProperties.java | 9 ++++++--- .../boot/autoconfigure/kafka/KafkaProperties.java | 3 ++- .../boot/autoconfigure/web/ServerProperties.java | 6 ++++-- .../web/embedded/TomcatWebServerFactoryCustomizer.java | 1 + .../boot/autoconfigure/web/servlet/WebMvcProperties.java | 3 ++- .../boot/autoconfigure/web/ServerPropertiesTests.java | 2 ++ 13 files changed, 35 insertions(+), 15 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java index d3994aa3289..2bafe29923f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java @@ -79,7 +79,8 @@ public class MetricsProperties { return this.enable; } - @DeprecatedConfigurationProperty(replacement = "management.observations.key-values") + @Deprecated(since = "3.2.0", forRemoval = true) + @DeprecatedConfigurationProperty(replacement = "management.observations.key-values", since = "3.2.0") public Map getTags() { return this.tags; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java index bf506756478..6293056f58a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java @@ -50,6 +50,7 @@ public class PropertiesMeterFilter implements MeterFilter { private final MeterFilter mapFilter; + @SuppressWarnings("removal") public PropertiesMeterFilter(MetricsProperties properties) { Assert.notNull(properties, "Properties must not be null"); this.properties = properties; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpProperties.java index ba3cc1145b1..e9a038d3e66 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpProperties.java @@ -78,11 +78,13 @@ public class OtlpProperties extends StepRegistryProperties { this.aggregationTemporality = aggregationTemporality; } - @DeprecatedConfigurationProperty(replacement = "management.opentelemetry.resource-attributes") + @Deprecated(since = "3.2.0", forRemoval = true) + @DeprecatedConfigurationProperty(replacement = "management.opentelemetry.resource-attributes", since = "3.2.0") public Map getResourceAttributes() { return this.resourceAttributes; } + @Deprecated(since = "3.2.0", forRemoval = true) public void setResourceAttributes(Map resourceAttributes) { this.resourceAttributes = resourceAttributes; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapter.java index 2d225499cbb..ebf406f30f9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapter.java @@ -58,6 +58,7 @@ class OtlpPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter resourceAttributes() { if (!CollectionUtils.isEmpty(this.openTelemetryProperties.getResourceAttributes())) { return this.openTelemetryProperties.getResourceAttributes(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapterTests.java index 5d6cbea3ffa..27bd22ccb7a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpPropertiesConfigAdapterTests.java @@ -65,6 +65,7 @@ class OtlpPropertiesConfigAdapterTests { } @Test + @SuppressWarnings("removal") void whenPropertiesResourceAttributesIsSetAdapterResourceAttributesReturnsIt() { this.properties.setResourceAttributes(Map.of("service.name", "boot-service")); assertThat(createAdapter().resourceAttributes()).containsEntry("service.name", "boot-service"); @@ -88,6 +89,7 @@ class OtlpPropertiesConfigAdapterTests { } @Test + @SuppressWarnings("removal") void openTelemetryPropertiesShouldOverrideOtlpPropertiesIfNotEmpty() { this.properties.setResourceAttributes(Map.of("a", "alpha")); this.openTelemetryProperties.setResourceAttributes(Map.of("b", "beta")); @@ -95,6 +97,7 @@ class OtlpPropertiesConfigAdapterTests { } @Test + @SuppressWarnings("removal") void openTelemetryPropertiesShouldNotOverrideOtlpPropertiesIfEmpty() { this.properties.setResourceAttributes(Map.of("a", "alpha")); this.openTelemetryProperties.setResourceAttributes(Collections.emptyMap()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java index 6132c73bbd3..222d71794dc 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java @@ -180,7 +180,8 @@ public class CouchbaseProperties { @Deprecated(since = "3.1.0", forRemoval = true) @DeprecatedConfigurationProperty( - reason = "SSL bundle support with spring.ssl.bundle and spring.couchbase.env.ssl.bundle should be used instead") + reason = "SSL bundle support with spring.ssl.bundle and spring.couchbase.env.ssl.bundle should be used instead", + since = "3.1.0") public String getKeyStore() { return this.keyStore; } @@ -192,7 +193,8 @@ public class CouchbaseProperties { @Deprecated(since = "3.1.0", forRemoval = true) @DeprecatedConfigurationProperty( - reason = "SSL bundle support with spring.ssl.bundle and spring.couchbase.env.ssl.bundle should be used instead") + reason = "SSL bundle support with spring.ssl.bundle and spring.couchbase.env.ssl.bundle should be used instead", + since = "3.1.0") public String getKeyStorePassword() { return this.keyStorePassword; } 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 bf1ea687e50..4a6d7db6e0c 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 @@ -736,7 +736,7 @@ public class FlywayProperties { this.licenseKey = licenseKey; } - @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.sqlplus") + @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.sqlplus", since = "3.2.0") @Deprecated(since = "3.2.0", forRemoval = true) public Boolean getOracleSqlplus() { return getOracle().getSqlplus(); @@ -747,7 +747,7 @@ public class FlywayProperties { getOracle().setSqlplus(oracleSqlplus); } - @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.sqlplus-warn") + @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.sqlplus-warn", since = "3.2.0") @Deprecated(since = "3.2.0", forRemoval = true) public Boolean getOracleSqlplusWarn() { return getOracle().getSqlplusWarn(); @@ -758,7 +758,7 @@ public class FlywayProperties { getOracle().setSqlplusWarn(oracleSqlplusWarn); } - @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.wallet-location") + @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.wallet-location", since = "3.2.0") @Deprecated(since = "3.2.0", forRemoval = true) public String getOracleWalletLocation() { return getOracle().getWalletLocation(); @@ -809,7 +809,7 @@ public class FlywayProperties { this.kerberosConfigFile = kerberosConfigFile; } - @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.kerberos-cache-file") + @DeprecatedConfigurationProperty(replacement = "spring.flyway.oracle.kerberos-cache-file", since = "3.2.0") @Deprecated(since = "3.2.0", forRemoval = true) public String getOracleKerberosCacheFile() { return getOracle().getKerberosCacheFile(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/influx/InfluxDbProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/influx/InfluxDbProperties.java index e4fd9d26b18..145c490c276 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/influx/InfluxDbProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/influx/InfluxDbProperties.java @@ -48,7 +48,8 @@ public class InfluxDbProperties { */ private String password; - @DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration") + @DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration", + since = "3.2.0") public String getUrl() { return this.url; } @@ -57,7 +58,8 @@ public class InfluxDbProperties { this.url = url; } - @DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration") + @DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration", + since = "3.2.0") public String getUser() { return this.user; } @@ -66,7 +68,8 @@ public class InfluxDbProperties { this.user = user; } - @DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration") + @DeprecatedConfigurationProperty(reason = "the new InfluxDb Java client provides Spring Boot integration", + since = "3.2.0") public String getPassword() { return this.password; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index c4b2f557349..7227df43f23 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -837,7 +837,8 @@ public class KafkaProperties { this.bootstrapServers = bootstrapServers; } - @DeprecatedConfigurationProperty(replacement = "spring.kafka.streams.state-store-cache-max-size") + @DeprecatedConfigurationProperty(replacement = "spring.kafka.streams.state-store-cache-max-size", + since = "3.1.0") @Deprecated(since = "3.1.0", forRemoval = true) public DataSize getCacheMaxSizeBuffering() { return this.cacheMaxSizeBuffering; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 1a053cd529b..e8742b414f6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -623,11 +623,13 @@ public class ServerProperties { this.connectionTimeout = connectionTimeout; } - @DeprecatedConfigurationProperty(reason = "The setting has been deprecated in Tomcat") + @Deprecated(since = "3.2.0", forRemoval = true) + @DeprecatedConfigurationProperty(reason = "The setting has been deprecated in Tomcat", since = "3.2.0") public boolean isRejectIllegalHeader() { return this.rejectIllegalHeader; } + @Deprecated(since = "3.2.0", forRemoval = true) public void setRejectIllegalHeader(boolean rejectIllegalHeader) { this.rejectIllegalHeader = rejectIllegalHeader; } @@ -1634,7 +1636,7 @@ public class ServerProperties { this.maxCookies = maxCookies; } - @DeprecatedConfigurationProperty(replacement = "server.undertow.decode-slash") + @DeprecatedConfigurationProperty(replacement = "server.undertow.decode-slash", since = "3.0.3") @Deprecated(forRemoval = true, since = "3.0.3") public boolean isAllowEncodedSlash() { return this.allowEncodedSlash; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java index 050edc74338..1e8250deda8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java @@ -84,6 +84,7 @@ public class TomcatWebServerFactoryCustomizer } @Override + @SuppressWarnings("removal") public void customize(ConfigurableTomcatWebServerFactory factory) { ServerProperties.Tomcat properties = this.serverProperties.getTomcat(); PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java index 2ca9ae03743..afdf35f6509 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcProperties.java @@ -126,7 +126,8 @@ public class WebMvcProperties { @Deprecated(since = "3.2.0", forRemoval = true) @DeprecatedConfigurationProperty( - reason = "DispatcherServlet property is deprecated for removal and should no longer need to be configured") + reason = "DispatcherServlet property is deprecated for removal and should no longer need to be configured", + since = "3.2.0") public boolean isThrowExceptionIfNoHandlerFound() { return this.throwExceptionIfNoHandlerFound; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 379aa6e32ce..07b26273054 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -114,6 +114,7 @@ class ServerPropertiesTests { } @Test + @SuppressWarnings("removal") void testTomcatBinding() { Map map = new HashMap<>(); map.put("server.tomcat.accesslog.conditionIf", "foo"); @@ -423,6 +424,7 @@ class ServerPropertiesTests { } @Test + @SuppressWarnings("removal") void tomcatRejectIllegalHeaderMatchesProtocolDefault() throws Exception { assertThat(getDefaultProtocol()).hasFieldOrPropertyWithValue("rejectIllegalHeader", this.properties.getTomcat().isRejectIllegalHeader());