From 2c2c1605795d9c05fc29f1b88050a2bb048a93c3 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 15 Jan 2021 09:53:45 +0100 Subject: [PATCH] Remove deprecated code See gh-24806 --- .../autoconfigure/metrics/MeterValue.java | 13 +- .../metrics/MetricsProperties.java | 9 +- .../ServiceLevelAgreementBoundary.java | 72 ------- .../metrics/PropertiesMeterFilterTests.java | 11 +- .../servlet/ManagementErrorEndpointTests.java | 11 +- .../cache/CachingOperationInvoker.java | 18 +- .../client/WebClientExchangeTags.java | 26 +-- .../batch/JobLauncherCommandLineRunner.java | 49 ----- .../cache/CouchbaseCacheConfiguration.java | 10 +- .../cassandra/CassandraProperties.java | 69 +------ .../rest/RestClientBuilderCustomizer.java | 36 ---- .../elasticsearch/rest/package-info.java | 21 -- .../mongo/MongoClientFactory.java | 28 +-- .../mongo/MongoClientFactorySupport.java | 11 +- .../mongo/ReactiveMongoClientFactory.java | 17 +- .../saml2/Saml2RelyingPartyProperties.java | 14 +- .../autoconfigure/web/ErrorProperties.java | 24 ++- .../autoconfigure/web/ServerProperties.java | 189 +----------------- .../web/format/WebConversionService.java | 14 +- .../web/reactive/WebFluxProperties.java | 14 +- .../error/AbstractErrorController.java | 17 +- .../servlet/error/BasicErrorController.java | 8 +- ...earchRestClientAutoConfigurationTests.java | 23 +-- .../Saml2RelyingPartyPropertiesTests.java | 12 +- .../web/ServerPropertiesTests.java | 73 +------ .../JettyWebServerFactoryCustomizerTests.java | 14 +- ...TomcatWebServerFactoryCustomizerTests.java | 22 +- .../WebFluxAutoConfigurationTests.java | 11 +- ...orWebExceptionHandlerIntegrationTests.java | 15 +- .../gradle/tasks/bundling/BootArchive.java | 24 +-- .../tasks/bundling/BootArchiveSupport.java | 22 +- .../boot/gradle/tasks/bundling/BootJar.java | 28 +-- .../boot/gradle/tasks/bundling/BootWar.java | 14 +- .../bundling/AbstractBootArchiveTests.java | 15 +- .../gradle/tasks/bundling/BootWarTests.java | 14 +- .../boot/loader/tools/Layout.java | 17 +- .../boot/loader/tools/Layouts.java | 14 +- .../boot/maven/AbstractRunMojo.java | 17 +- .../boot/SpringApplication.java | 14 +- .../undertow/UndertowServletWebServer.java | 55 +---- .../embedded/undertow/UndertowWebServer.java | 16 +- .../error/DefaultErrorAttributes.java | 29 +-- .../web/reactive/error/ErrorAttributes.java | 19 +- .../servlet/error/DefaultErrorAttributes.java | 29 +-- .../web/servlet/error/ErrorAttributes.java | 20 +- .../web/servlet/error/ErrorController.java | 12 +- .../error/DefaultErrorAttributesTests.java | 15 +- .../error/DefaultErrorAttributesTests.java | 13 +- 48 files changed, 89 insertions(+), 1149 deletions(-) delete mode 100644 spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java index 2d3f31b505..94ad8dd975 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,17 +93,6 @@ public final class MeterValue { return new MeterValue(DurationStyle.detectAndParse(value)); } - /** - * Return a new {@link MeterValue} instance for the given long value. - * @param value the source value - * @return a {@link MeterValue} instance - * @deprecated as of 2.3.0 in favor of {@link #valueOf(double)} - */ - @Deprecated - public static MeterValue valueOf(long value) { - return new MeterValue(value); - } - /** * Return a new {@link MeterValue} instance for the given double value. * @param value the source value 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 ecc4e6865b..c2b9be11d2 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import java.util.LinkedHashMap; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.boot.context.properties.NestedConfigurationProperty; /** @@ -262,12 +261,6 @@ public class MetricsProperties { return this.percentiles; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "management.metrics.distribution.slo") - public Map getSla() { - return this.slo; - } - public Map getSlo() { return this.slo; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java deleted file mode 100644 index a6a8014a90..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/ServiceLevelAgreementBoundary.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2012-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure.metrics; - -import java.time.Duration; - -import io.micrometer.core.instrument.Meter; - -/** - * A boundary for a service-level agreement (SLA) for use when configuring Micrometer. Can - * be specified as either a {@link Long} (applicable to timers and distribution summaries) - * or a {@link Duration} (applicable to only timers). - * - * @author Phillip Webb - * @since 2.0.0 - * @deprecated as of 2.3.0 in favor of {@link ServiceLevelObjectiveBoundary} - */ -@Deprecated -public final class ServiceLevelAgreementBoundary { - - private final MeterValue value; - - ServiceLevelAgreementBoundary(MeterValue value) { - this.value = value; - } - - /** - * Return the underlying value of the SLA in form suitable to apply to the given meter - * type. - * @param meterType the meter type - * @return the value or {@code null} if the value cannot be applied - */ - public Long getValue(Meter.Type meterType) { - Double value = this.value.getValue(meterType); - return (value != null) ? value.longValue() : null; - } - - /** - * Return a new {@link ServiceLevelAgreementBoundary} instance for the given long - * value. - * @param value the source value - * @return a {@link ServiceLevelAgreementBoundary} instance - */ - public static ServiceLevelAgreementBoundary valueOf(long value) { - return new ServiceLevelAgreementBoundary(MeterValue.valueOf(value)); - } - - /** - * Return a new {@link ServiceLevelAgreementBoundary} instance for the given String - * value. - * @param value the source value - * @return a {@link ServiceLevelAgreementBoundary} instance - */ - public static ServiceLevelAgreementBoundary valueOf(String value) { - return new ServiceLevelAgreementBoundary(MeterValue.valueOf(value)); - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java index 7ee94fc293..7d6611df10 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -203,15 +203,6 @@ class PropertiesMeterFilterTests { .containsExactly(1, 1.5, 2); } - @Test - @Deprecated - void configureWhenHasDeprecatedSlaShouldSetSlaToValue() { - PropertiesMeterFilter filter = new PropertiesMeterFilter( - createProperties("distribution.sla.spring.boot=1,2,3")); - assertThat(filter.configure(createMeterId("spring.boot"), DistributionStatisticConfig.DEFAULT) - .getServiceLevelObjectiveBoundaries()).containsExactly(1000000, 2000000, 3000000); - } - @Test void configureWhenHasSloShouldSetSloToValue() { PropertiesMeterFilter filter = new PropertiesMeterFilter( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java index c72b31655b..0dc697ef6c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/ManagementErrorEndpointTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -128,13 +128,12 @@ class ManagementErrorEndpointTests { } @Test - void errorResponseWithDefaultErrorAttributesSubclassUsingDeprecatedApiAndDelegation() { + void errorResponseWithDefaultErrorAttributesSubclassUsingDelegation() { ErrorAttributes attributes = new DefaultErrorAttributes() { @Override - @SuppressWarnings("deprecation") - public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { - Map response = super.getErrorAttributes(webRequest, includeStackTrace); + public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { + Map response = super.getErrorAttributes(webRequest, options); response.put("error", "custom error"); response.put("custom", "value"); response.remove("path"); @@ -151,7 +150,7 @@ class ManagementErrorEndpointTests { } @Test - void errorResponseWithDefaultErrorAttributesSubclassUsingDeprecatedApiWithoutDelegation() { + void errorResponseWithDefaultErrorAttributesSubclassWithoutDelegation() { ErrorAttributes attributes = new DefaultErrorAttributes() { @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java index 0b3d4a52e8..be27aa3c0b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,22 +104,6 @@ public class CachingOperationInvoker implements OperationInvoker { return new CachedResponse(response, accessTime); } - /** - * Apply caching configuration when appropriate to the given invoker. - * @param invoker the invoker to wrap - * @param timeToLive the maximum time in milliseconds that a response can be cached - * @return a caching version of the invoker or the original instance if caching is not - * required - * @deprecated as of 2.3.0 to make it package-private in 2.4 - */ - @Deprecated - public static OperationInvoker apply(OperationInvoker invoker, long timeToLive) { - if (timeToLive > 0) { - return new CachingOperationInvoker(invoker, timeToLive); - } - return invoker; - } - /** * A cached response that encapsulates the response itself and the time at which it * was created. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java index 4a94264265..6d0af88c6b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,30 +94,6 @@ public final class WebClientExchangeTags { return CLIENT_ERROR; } - /** - * Creates a {@code status} {@code Tag} derived from the - * {@link ClientResponse#statusCode()} of the given {@code response}. - * @param response the response - * @return the status tag - * @deprecated since 2.3.0 in favor of {@link #status(ClientResponse, Throwable)} - */ - @Deprecated - public static Tag status(ClientResponse response) { - return Tag.of("status", String.valueOf(response.rawStatusCode())); - } - - /** - * Creates a {@code status} {@code Tag} derived from the exception thrown by the - * client. - * @param throwable the exception - * @return the status tag - * @deprecated since 2.3.0 in favor of {@link #status(ClientResponse, Throwable)} - */ - @Deprecated - public static Tag status(Throwable throwable) { - return (throwable instanceof IOException) ? IO_ERROR : CLIENT_ERROR; - } - /** * Create a {@code clientName} {@code Tag} derived from the * {@link java.net.URI#getHost host} of the {@link ClientRequest#url() URL} of the diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java deleted file mode 100644 index 7832c0a7fd..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2012-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.batch; - -import org.springframework.batch.core.explore.JobExplorer; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.boot.ApplicationRunner; - -/** - * {@link ApplicationRunner} to {@link JobLauncher launch} Spring Batch jobs. Runs all - * jobs in the surrounding context by default. Can also be used to launch a specific job - * by providing a jobName. - * - * @author Dave Syer - * @author Jean-Pierre Bergamin - * @author Mahmoud Ben Hassine - * @since 1.0.0 - * @deprecated since 2.3.0 in favor of {@link JobLauncherApplicationRunner} - */ -@Deprecated -public class JobLauncherCommandLineRunner extends JobLauncherApplicationRunner { - - /** - * Create a new {@link JobLauncherCommandLineRunner}. - * @param jobLauncher to launch jobs - * @param jobExplorer to check the job repository for previous executions - * @param jobRepository to check if a job instance exists with the given parameters - * when running a job - */ - public JobLauncherCommandLineRunner(JobLauncher jobLauncher, JobExplorer jobExplorer, JobRepository jobRepository) { - super(jobLauncher, jobExplorer, jobRepository); - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java index 12028d2f2c..a4ba5952d7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CouchbaseCacheConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,20 +39,16 @@ import org.springframework.util.ObjectUtils; * Couchbase cache configuration. * * @author Stephane Nicoll - * @since 1.4.0 - * @deprecated since 2.3.3 as this class is not intended for public use. It will be made - * package-private in a future release */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass({ Cluster.class, CouchbaseClientFactory.class, CouchbaseCacheManager.class }) @ConditionalOnMissingBean(CacheManager.class) @ConditionalOnSingleCandidate(CouchbaseClientFactory.class) @Conditional(CacheCondition.class) -@Deprecated -public class CouchbaseCacheConfiguration { +class CouchbaseCacheConfiguration { @Bean - public CouchbaseCacheManager cacheManager(CacheProperties cacheProperties, CacheManagerCustomizers customizers, + CouchbaseCacheManager cacheManager(CacheProperties cacheProperties, CacheManagerCustomizers customizers, ObjectProvider couchbaseCacheManagerBuilderCustomizers, CouchbaseClientFactory clientFactory) { List cacheNames = cacheProperties.getCacheNames(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java index 6facba1a43..b21e5bd535 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cassandra/CassandraProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import java.util.List; import com.datastax.oss.driver.api.core.DefaultConsistencyLevel; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; /** * Configuration properties for Cassandra. @@ -126,17 +125,6 @@ public class CassandraProperties { this.sessionName = sessionName; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.session-name") - public String getClusterName() { - return getSessionName(); - } - - @Deprecated - public void setClusterName(String clusterName) { - setSessionName(clusterName); - } - public List getContactPoints() { return this.contactPoints; } @@ -181,61 +169,6 @@ public class CassandraProperties { this.compression = compression; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.consistency") - public DefaultConsistencyLevel getConsistencyLevel() { - return getRequest().getConsistency(); - } - - @Deprecated - public void setConsistencyLevel(DefaultConsistencyLevel consistency) { - getRequest().setConsistency(consistency); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.serial-consistency") - public DefaultConsistencyLevel getSerialConsistencyLevel() { - return getRequest().getSerialConsistency(); - } - - @Deprecated - public void setSerialConsistencyLevel(DefaultConsistencyLevel serialConsistency) { - getRequest().setSerialConsistency(serialConsistency); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.page-size") - public int getFetchSize() { - return getRequest().getPageSize(); - } - - @Deprecated - public void setFetchSize(int fetchSize) { - getRequest().setPageSize(fetchSize); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.connection.init-query-timeout") - public Duration getConnectTimeout() { - return getConnection().getInitQueryTimeout(); - } - - @Deprecated - public void setConnectTimeout(Duration connectTimeout) { - getConnection().setInitQueryTimeout(connectTimeout); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.data.cassandra.request.timeout") - public Duration getReadTimeout() { - return getRequest().getTimeout(); - } - - @Deprecated - public void setReadTimeout(Duration readTimeout) { - getRequest().setTimeout(readTimeout); - } - public boolean isSsl() { return this.ssl; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java deleted file mode 100644 index f31e7309c2..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientBuilderCustomizer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.elasticsearch.rest; - -import org.elasticsearch.client.RestClientBuilder; - -/** - * Callback interface that can be implemented by beans wishing to further customize the - * {@link org.elasticsearch.client.RestClient} via a {@link RestClientBuilder} whilst - * retaining default auto-configuration. - * - * @author Brian Clozel - * @since 2.1.0 - * @deprecated as of 2.3.1 in favor of - * {@link org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer} - */ -@FunctionalInterface -@Deprecated -public interface RestClientBuilderCustomizer - extends org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer { - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java deleted file mode 100644 index a57c5bc461..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2012-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Deprecated auto-configuration for Elasticsearch client, superseded by classes in - * {@code org.springframework.boot.autoconfigure.elasticsearch}. - */ -package org.springframework.boot.autoconfigure.elasticsearch.rest; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java index 97f2794ad2..d0c31bfd4a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,6 @@ import java.util.List; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoClients; -import org.springframework.core.env.Environment; - /** * A factory for a blocking {@link MongoClient}. * @@ -39,30 +37,6 @@ import org.springframework.core.env.Environment; */ public class MongoClientFactory extends MongoClientFactorySupport { - /** - * Construct a factory for creating a blocking {@link MongoClient}. - * @param properties configuration properties - * @param environment a Spring {@link Environment} containing configuration properties - * @deprecated since 2.3.0 in favor of {@link #MongoClientFactory(List)} - */ - @Deprecated - public MongoClientFactory(MongoProperties properties, Environment environment) { - this(null); - } - - /** - * Construct a factory for creating a blocking {@link MongoClient}. - * @param properties configuration properties - * @param environment a Spring {@link Environment} containing configuration properties - * @param builderCustomizers a list of configuration settings customizers - * @deprecated since 2.4.0 in favor of {@link #MongoClientFactory(List)} - */ - @Deprecated - public MongoClientFactory(MongoProperties properties, Environment environment, - List builderCustomizers) { - this(builderCustomizers); - } - /** * Construct a factory for creating a blocking {@link MongoClient}. * @param builderCustomizers a list of configuration settings customizers diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java index 294740b536..be841adec8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactorySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,6 @@ import com.mongodb.MongoClientSettings; import com.mongodb.MongoClientSettings.Builder; import com.mongodb.MongoDriverInformation; -import org.springframework.core.env.Environment; - /** * Base class for setup that is common to MongoDB client factories. * @@ -40,13 +38,6 @@ public abstract class MongoClientFactorySupport { private final BiFunction clientCreator; - @Deprecated - protected MongoClientFactorySupport(MongoProperties properties, Environment environment, - List builderCustomizers, - BiFunction clientCreator) { - this(builderCustomizers, clientCreator); - } - protected MongoClientFactorySupport(List builderCustomizers, BiFunction clientCreator) { this.builderCustomizers = (builderCustomizers != null) ? builderCustomizers : Collections.emptyList(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java index 560579c75a..2a026db760 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,6 @@ import java.util.List; import com.mongodb.reactivestreams.client.MongoClient; import com.mongodb.reactivestreams.client.MongoClients; -import org.springframework.core.env.Environment; - /** * A factory for a reactive {@link MongoClient}. * @@ -33,19 +31,6 @@ import org.springframework.core.env.Environment; */ public class ReactiveMongoClientFactory extends MongoClientFactorySupport { - /** - * Construct a factory for creating a {@link MongoClient}. - * @param properties configuration properties - * @param environment a Spring {@link Environment} containing configuration properties - * @param builderCustomizers a list of configuration settings customizers - * @deprecated since 2.4.0 in favor of {@link #ReactiveMongoClientFactory(List)} - */ - @Deprecated - public ReactiveMongoClientFactory(MongoProperties properties, Environment environment, - List builderCustomizers) { - super(properties, environment, builderCustomizers, MongoClients::create); - } - /** * Construct a factory for creating a {@link MongoClient}. * @param builderCustomizers a list of configuration settings customizers diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java index dc49c2dd65..dd7334c093 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.core.io.Resource; import org.springframework.security.saml2.provider.service.registration.Saml2MessageBinding; @@ -257,17 +256,6 @@ public class Saml2RelyingPartyProperties { this.metadataUri = metadataUri; } - @Deprecated - @DeprecatedConfigurationProperty(reason = "moved to 'singlesignon.url'") - public String getSsoUrl() { - return this.singlesignon.getUrl(); - } - - @Deprecated - public void setSsoUrl(String ssoUrl) { - this.singlesignon.setUrl(ssoUrl); - } - public Singlesignon getSinglesignon() { return this.singlesignon; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java index 811c113cc6..11db4e7670 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,6 +101,28 @@ public class ErrorProperties { return this.whitelabel; } + /** + * Include Stacktrace attribute options. + */ + public enum IncludeStacktrace { + + /** + * Never add stacktrace information. + */ + NEVER, + + /** + * Always add stacktrace information. + */ + ALWAYS, + + /** + * Add error attribute when the appropriate request parameter is "true". + */ + ON_PARAM + + } + /** * Include error attributes options. */ 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 7de40d8a64..eb6f29d828 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import java.util.Map; import io.undertow.UndertowOptions; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.web.server.Compression; @@ -411,28 +410,6 @@ public class ServerProperties { */ private final Remoteip remoteip = new Remoteip(); - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.tomcat.threads.max") - public int getMaxThreads() { - return getThreads().getMax(); - } - - @Deprecated - public void setMaxThreads(int maxThreads) { - getThreads().setMax(maxThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.tomcat.threads.min-spare") - public int getMinSpareThreads() { - return getThreads().getMinSpare(); - } - - @Deprecated - public void setMinSpareThreads(int minSpareThreads) { - getThreads().setMinSpare(minSpareThreads); - } - public DataSize getMaxHttpFormPostSize() { return this.maxHttpFormPostSize; } @@ -465,72 +442,6 @@ public class ServerProperties { this.basedir = basedir; } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.internal-proxies") - @Deprecated - public String getInternalProxies() { - return this.remoteip.getInternalProxies(); - } - - @Deprecated - public void setInternalProxies(String internalProxies) { - this.remoteip.setInternalProxies(internalProxies); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.protocol-header") - @Deprecated - public String getProtocolHeader() { - return this.remoteip.getProtocolHeader(); - } - - @Deprecated - public void setProtocolHeader(String protocolHeader) { - this.remoteip.setProtocolHeader(protocolHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.protocol-header-https-value") - @Deprecated - public String getProtocolHeaderHttpsValue() { - return this.remoteip.getProtocolHeaderHttpsValue(); - } - - @Deprecated - public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { - this.remoteip.setProtocolHeaderHttpsValue(protocolHeaderHttpsValue); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.host-header") - @Deprecated - public String getHostHeader() { - return this.remoteip.getHostHeader(); - } - - @Deprecated - public void setHostHeader(String hostHeader) { - this.remoteip.setHostHeader(hostHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote.port-header") - @Deprecated - public String getPortHeader() { - return this.remoteip.getPortHeader(); - } - - @Deprecated - public void setPortHeader(String portHeader) { - this.remoteip.setPortHeader(portHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.remote-ip-header") - @Deprecated - public String getRemoteIpHeader() { - return this.remoteip.getRemoteIpHeader(); - } - - @Deprecated - public void setRemoteIpHeader(String remoteIpHeader) { - this.remoteip.setRemoteIpHeader(remoteIpHeader); - } - public Boolean getRedirectContextRoot() { return this.redirectContextRoot; } @@ -539,11 +450,6 @@ public class ServerProperties { this.redirectContextRoot = redirectContextRoot; } - @Deprecated - public Boolean getUseRelativeRedirects() { - return this.useRelativeRedirects; - } - public boolean isUseRelativeRedirects() { return this.useRelativeRedirects; } @@ -552,11 +458,6 @@ public class ServerProperties { this.useRelativeRedirects = useRelativeRedirects; } - @Deprecated - public void setUseRelativeRedirects(Boolean useRelativeRedirects) { - this.useRelativeRedirects = (useRelativeRedirects != null) ? useRelativeRedirects : false; - } - public Charset getUriEncoding() { return this.uriEncoding; } @@ -1093,72 +994,6 @@ public class ServerProperties { this.maxHttpFormPostSize = maxHttpFormPostSize; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.acceptors") - public Integer getAcceptors() { - return getThreads().getAcceptors(); - } - - @Deprecated - public void setAcceptors(Integer acceptors) { - getThreads().setAcceptors(acceptors); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.selectors") - public Integer getSelectors() { - return getThreads().getSelectors(); - } - - @Deprecated - public void setSelectors(Integer selectors) { - getThreads().setSelectors(selectors); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.min") - public Integer getMinThreads() { - return getThreads().getMin(); - } - - @Deprecated - public void setMinThreads(Integer minThreads) { - getThreads().setMin(minThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.max") - public Integer getMaxThreads() { - return getThreads().getMax(); - } - - @Deprecated - public void setMaxThreads(Integer maxThreads) { - getThreads().setMax(maxThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.max-queue-capacity") - public Integer getMaxQueueCapacity() { - return getThreads().getMaxQueueCapacity(); - } - - @Deprecated - public void setMaxQueueCapacity(Integer maxQueueCapacity) { - getThreads().setMaxQueueCapacity(maxQueueCapacity); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.jetty.threads.idle-timeout") - public Duration getThreadIdleTimeout() { - return getThreads().getIdleTimeout(); - } - - @Deprecated - public void setThreadIdleTimeout(Duration threadIdleTimeout) { - getThreads().setIdleTimeout(threadIdleTimeout); - } - public Duration getConnectionIdleTimeout() { return this.connectionIdleTimeout; } @@ -1579,28 +1414,6 @@ public class ServerProperties { this.bufferSize = bufferSize; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.undertow.threads.io") - public Integer getIoThreads() { - return getThreads().getIo(); - } - - @Deprecated - public void setIoThreads(Integer ioThreads) { - getThreads().setIo(ioThreads); - } - - @Deprecated - @DeprecatedConfigurationProperty(replacement = "server.undertow.threads.worker") - public Integer getWorkerThreads() { - return getThreads().getWorker(); - } - - @Deprecated - public void setWorkerThreads(Integer workerThreads) { - getThreads().setWorker(workerThreads); - } - public Boolean getDirectBuffers() { return this.directBuffers; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java index 2aa3c91dcf..82a229ca1e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/format/WebConversionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,18 +46,6 @@ public class WebConversionService extends DefaultFormattingConversionService { private static final boolean JSR_354_PRESENT = ClassUtils.isPresent("javax.money.MonetaryAmount", WebConversionService.class.getClassLoader()); - /** - * Create a new WebConversionService that configures formatters with the provided date - * format, or register the default ones if no custom format is provided. - * @param dateFormat the custom date format to use for date conversions - * @deprecated since 2.3.0 in favor of - * {@link #WebConversionService(DateTimeFormatters)} - */ - @Deprecated - public WebConversionService(String dateFormat) { - this(new DateTimeFormatters().dateFormat(dateFormat)); - } - /** * Create a new WebConversionService that configures formatters with the provided * date, time, and date-time formats, or registers the default if no custom format is diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java index b4a991232b..db57808b5e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.web.reactive; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.util.StringUtils; /** @@ -62,17 +61,6 @@ public class WebFluxProperties { return candidate; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.webflux.format.date") - public String getDateFormat() { - return this.format.getDate(); - } - - @Deprecated - public void setDateFormat(String dateFormat) { - this.format.setDate(dateFormat); - } - public Format getFormat() { return this.format; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java index edbce0d914..9e00a0944e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.boot.web.error.ErrorAttributeOptions; -import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.boot.web.servlet.error.ErrorAttributes; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.core.annotation.AnnotationAwareOrderComparator; @@ -70,20 +69,6 @@ public abstract class AbstractErrorController implements ErrorController { return sorted; } - /** - * Returns a {@link Map} of the error attributes. - * @param request the source request - * @param includeStackTrace if stack trace elements should be included - * @return the error attributes - * @deprecated since 2.3.0 in favor of - * {@link #getErrorAttributes(HttpServletRequest, ErrorAttributeOptions)} - */ - @Deprecated - protected Map getErrorAttributes(HttpServletRequest request, boolean includeStackTrace) { - return getErrorAttributes(request, - (includeStackTrace) ? ErrorAttributeOptions.of(Include.STACK_TRACE) : ErrorAttributeOptions.defaults()); - } - protected Map getErrorAttributes(HttpServletRequest request, ErrorAttributeOptions options) { WebRequest webRequest = new ServletWebRequest(request); return this.errorAttributes.getErrorAttributes(webRequest, options); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java index e9bd4c30b0..d9d0bb052a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,12 +81,6 @@ public class BasicErrorController extends AbstractErrorController { this.errorProperties = errorProperties; } - @Override - @Deprecated - public String getErrorPath() { - return null; - } - @RequestMapping(produces = MediaType.TEXT_HTML_VALUE) public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) { HttpStatus status = getStatus(request); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java index 3ed962ad38..47110d7f4c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchRestClientAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,16 +107,6 @@ class ElasticsearchRestClientAutoConfigurationTests { }); } - @Test - @Deprecated - void configureWhenDeprecatedBuilderCustomizerShouldApply() { - this.contextRunner.withUserConfiguration(DeprecatedBuilderCustomizerConfiguration.class).run((context) -> { - assertThat(context).hasSingleBean(RestHighLevelClient.class); - RestHighLevelClient restClient = context.getBean(RestHighLevelClient.class); - assertThat(restClient.getLowLevelClient()).hasFieldOrPropertyWithValue("pathPrefix", "/deprecated"); - }); - } - @Test void configureWithNoTimeoutsApplyDefaults() { this.contextRunner.run((context) -> { @@ -296,17 +286,6 @@ class ElasticsearchRestClientAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @Deprecated - static class DeprecatedBuilderCustomizerConfiguration { - - @Bean - org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientBuilderCustomizer myCustomizer() { - return (builder) -> builder.setPathPrefix("/deprecated"); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomRestHighLevelClientConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java index 7018e733bd..df3a02ace7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,16 +39,6 @@ class Saml2RelyingPartyPropertiesTests { private final Saml2RelyingPartyProperties properties = new Saml2RelyingPartyProperties(); - @Deprecated - @Test - void customizeSsoUrlDeprecated() { - bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.sso-url", - "https://simplesaml-for-spring-saml/SSOService.php"); - assertThat( - this.properties.getRegistration().get("simplesamlphp").getIdentityprovider().getSinglesignon().getUrl()) - .isEqualTo("https://simplesaml-for-spring-saml/SSOService.php"); - } - @Test void customizeSsoUrl() { bind("spring.security.saml2.relyingparty.registration.simplesamlphp.identity-provider.single-sign-on.url", 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 6d4414523a..64477313bf 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,105 +216,48 @@ class ServerPropertiesTests { assertThat(this.properties.getTomcat().getThreads().getMax()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeTomcatMaxThreadsDeprecated() { - bind("server.tomcat.maxThreads", "10"); - assertThat(this.properties.getTomcat().getThreads().getMax()).isEqualTo(10); - } - @Test void testCustomizeTomcatMinSpareThreads() { bind("server.tomcat.threads.min-spare", "10"); assertThat(this.properties.getTomcat().getThreads().getMinSpare()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeTomcatMinSpareThreadsDeprecated() { - bind("server.tomcat.min-spare-threads", "10"); - assertThat(this.properties.getTomcat().getThreads().getMinSpare()).isEqualTo(10); - } - @Test void testCustomizeJettyAcceptors() { bind("server.jetty.threads.acceptors", "10"); assertThat(this.properties.getJetty().getThreads().getAcceptors()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettyAcceptorsDeprecated() { - bind("server.jetty.acceptors", "10"); - assertThat(this.properties.getJetty().getThreads().getAcceptors()).isEqualTo(10); - } - @Test void testCustomizeJettySelectors() { bind("server.jetty.threads.selectors", "10"); assertThat(this.properties.getJetty().getThreads().getSelectors()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettySelectorsDeprecated() { - bind("server.jetty.selectors", "10"); - assertThat(this.properties.getJetty().getSelectors()).isEqualTo(10); - assertThat(this.properties.getJetty().getThreads().getSelectors()).isEqualTo(10); - } - @Test void testCustomizeJettyMaxThreads() { bind("server.jetty.threads.max", "10"); assertThat(this.properties.getJetty().getThreads().getMax()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettyMaxThreadsDeprecated() { - bind("server.jetty.maxThreads", "10"); - assertThat(this.properties.getJetty().getThreads().getMax()).isEqualTo(10); - } - @Test void testCustomizeJettyMinThreads() { bind("server.jetty.threads.min", "10"); assertThat(this.properties.getJetty().getThreads().getMin()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeJettyMinThreadsDeprecated() { - bind("server.jetty.minThreads", "10"); - assertThat(this.properties.getJetty().getThreads().getMin()).isEqualTo(10); - } - @Test void testCustomizeJettyIdleTimeout() { bind("server.jetty.threads.idle-timeout", "10s"); assertThat(this.properties.getJetty().getThreads().getIdleTimeout()).isEqualTo(Duration.ofSeconds(10)); } - @Deprecated - @Test - void testCustomizeJettyIdleTimeoutDeprecated() { - bind("server.jetty.thread-idle-timeout", "10s"); - assertThat(this.properties.getJetty().getThreads().getIdleTimeout()).hasSeconds(10); - } - @Test void testCustomizeJettyMaxQueueCapacity() { bind("server.jetty.threads.max-queue-capacity", "5150"); assertThat(this.properties.getJetty().getThreads().getMaxQueueCapacity()).isEqualTo(5150); } - @Deprecated - @Test - void testCustomizeJettyMaxQueueCapacityDeprecated() { - bind("server.jetty.max-queue-capacity", "5150"); - assertThat(this.properties.getJetty().getThreads().getMaxQueueCapacity()).isEqualTo(5150); - } - @Test void testCustomizeUndertowServerOption() { bind("server.undertow.options.server.ALWAYS_SET_KEEP_ALIVE", "true"); @@ -335,26 +278,12 @@ class ServerPropertiesTests { assertThat(this.properties.getUndertow().getThreads().getIo()).isEqualTo(4); } - @Deprecated - @Test - void testCustomizeUndertowIoThreadsDeprecated() { - bind("server.undertow.ioThreads", "4"); - assertThat(this.properties.getUndertow().getThreads().getIo()).isEqualTo(4); - } - @Test void testCustomizeUndertowWorkerThreads() { bind("server.undertow.threads.worker", "10"); assertThat(this.properties.getUndertow().getThreads().getWorker()).isEqualTo(10); } - @Deprecated - @Test - void testCustomizeUndertowWorkerThreadsDeprecated() { - bind("server.undertow.workerThreads", "10"); - assertThat(this.properties.getUndertow().getThreads().getWorker()).isEqualTo(10); - } - @Test void testCustomizeJettyAccessLog() { Map map = new HashMap<>(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java index f038700526..04330276d6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/JettyWebServerFactoryCustomizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,7 +164,7 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolMaxThreadsCanBeCustomized() { - bind("server.jetty.max-threads=100"); + bind("server.jetty.threads.max=100"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMaxThreads()).isEqualTo(100); @@ -172,7 +172,7 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolMinThreadsCanBeCustomized() { - bind("server.jetty.min-threads=100"); + bind("server.jetty.threads.min=100"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMinThreads()).isEqualTo(100); @@ -198,8 +198,8 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolWithMaxQueueCapacityEqualToZeroCustomizesThreadPool() { - bind("server.jetty.threads.max-queue-capacity=0", "server.jetty.min-threads=100", - "server.jetty.max-threads=100", "server.jetty.threads.idle-timeout=6s"); + bind("server.jetty.threads.max-queue-capacity=0", "server.jetty.threads.min=100", + "server.jetty.threads.max=100", "server.jetty.threads.idle-timeout=6s"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMinThreads()).isEqualTo(100); @@ -220,8 +220,8 @@ class JettyWebServerFactoryCustomizerTests { @Test void threadPoolWithMaxQueueCapacityPositiveCustomizesThreadPool() { - bind("server.jetty.threads.max-queue-capacity=1234", "server.jetty.min-threads=10", - "server.jetty.max-threads=150", "server.jetty.threads.idle-timeout=3s"); + bind("server.jetty.threads.max-queue-capacity=1234", "server.jetty.threads.min=10", + "server.jetty.threads.max=150", "server.jetty.threads.idle-timeout=3s"); JettyWebServer server = customizeAndGetServer(); QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool(); assertThat(threadPool.getMinThreads()).isEqualTo(10); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java index 74d8518cd3..4b6416b0a6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -186,26 +186,6 @@ class TomcatWebServerFactoryCustomizerTests { assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); } - @Test - @Deprecated - void customRemoteIpValveWithDeprecatedProperties() { - bind("server.tomcat.remote-ip-header=x-my-remote-ip-header", - "server.tomcat.protocol-header=x-my-protocol-header", "server.tomcat.internal-proxies=192.168.0.1", - "server.tomcat.host-header=x-my-forward-host", "server.tomcat.port-header=x-my-forward-port", - "server.tomcat.protocol-header-https-value=On"); - TomcatServletWebServerFactory factory = customizeAndGetFactory(); - assertThat(factory.getEngineValves()).hasSize(1); - Valve valve = factory.getEngineValves().iterator().next(); - assertThat(valve).isInstanceOf(RemoteIpValve.class); - RemoteIpValve remoteIpValve = (RemoteIpValve) valve; - assertThat(remoteIpValve.getProtocolHeader()).isEqualTo("x-my-protocol-header"); - assertThat(remoteIpValve.getProtocolHeaderHttpsValue()).isEqualTo("On"); - assertThat(remoteIpValve.getRemoteIpHeader()).isEqualTo("x-my-remote-ip-header"); - assertThat(remoteIpValve.getHostHeader()).isEqualTo("x-my-forward-host"); - assertThat(remoteIpValve.getPortHeader()).isEqualTo("x-my-forward-port"); - assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); - } - @Test void customStaticResourceAllowCaching() { bind("server.tomcat.resource.allow-caching=false"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java index 421fed5cb4..c105b0f328 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -212,15 +212,6 @@ class WebFluxAutoConfigurationTests { }); } - @Test - void customDateFormatWithDeprecatedProperty() { - this.contextRunner.withPropertyValues("spring.webflux.date-format:dd*MM*yyyy").run((context) -> { - FormattingConversionService conversionService = context.getBean(FormattingConversionService.class); - Date date = Date.from(ZonedDateTime.of(1988, 6, 25, 20, 30, 0, 0, ZoneId.systemDefault()).toInstant()); - assertThat(conversionService.convert(date, String.class)).isEqualTo("25*06*1988"); - }); - } - @Test void customDateFormat() { this.contextRunner.withPropertyValues("spring.webflux.format.date:dd*MM*yyyy").run((context) -> { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java index 97a8ca73b4..08cab75a09 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplic import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.reactive.error.DefaultErrorAttributes; import org.springframework.boot.web.reactive.error.ErrorAttributes; import org.springframework.context.annotation.Bean; @@ -337,7 +338,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { } @Test - void defaultErrorAttributesSubclassUsingDeprecatedApiAndDelegation() { + void defaultErrorAttributesSubclassUsingDelegation() { this.contextRunner.withUserConfiguration(CustomErrorAttributesWithDelegation.class).run((context) -> { WebTestClient client = getWebClient(context); client.get().uri("/badRequest").exchange().expectStatus().isBadRequest().expectBody().jsonPath("status") @@ -347,7 +348,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { } @Test - void defaultErrorAttributesSubclassUsingDeprecatedApiWithoutDelegation() { + void defaultErrorAttributesSubclassWithoutDelegation() { this.contextRunner.withUserConfiguration(CustomErrorAttributesWithoutDelegation.class).run((context) -> { WebTestClient client = getWebClient(context); client.get().uri("/badRequest").exchange().expectStatus().isBadRequest().expectBody().jsonPath("status") @@ -425,9 +426,8 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { ErrorAttributes errorAttributes() { return new DefaultErrorAttributes() { @Override - @SuppressWarnings("deprecation") - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { - Map errorAttributes = super.getErrorAttributes(request, includeStackTrace); + public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { + Map errorAttributes = super.getErrorAttributes(request, options); errorAttributes.put("error", "custom error"); errorAttributes.put("newAttribute", "value"); errorAttributes.remove("path"); @@ -446,8 +446,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests { ErrorAttributes errorAttributes() { return new DefaultErrorAttributes() { @Override - @SuppressWarnings("deprecation") - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { + public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { Map errorAttributes = new HashMap<>(); errorAttributes.put("status", 400); errorAttributes.put("error", "custom error"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java index a03c2f0b0e..126f2a0cc5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -128,26 +128,4 @@ public interface BootArchive extends Task { */ void setClasspath(FileCollection classpath); - /** - * Returns {@code true} if the Devtools jar should be excluded, otherwise - * {@code false}. - * @return {@code true} if the Devtools jar should be excluded, or {@code false} if - * not - * @deprecated since 2.3.0 in favour of configuring a classpath that does not include - * development-only dependencies - */ - @Input - @Deprecated - boolean isExcludeDevtools(); - - /** - * Sets whether or not the Devtools jar should be excluded. - * @param excludeDevtools {@code true} if the Devtools jar should be excluded, or - * {@code false} if not - * @deprecated since 2.3.0 in favour of configuring a classpath that does not include - * development-only dependencies - */ - @Deprecated - void setExcludeDevtools(boolean excludeDevtools); - } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java index d316188040..debc5b5c8f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchiveSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,15 +76,12 @@ class BootArchiveSupport { private LaunchScriptConfiguration launchScript; - private boolean excludeDevtools = false; - BootArchiveSupport(String loaderMainClass, Spec librarySpec, Function compressionResolver) { this.loaderMainClass = loaderMainClass; this.librarySpec = librarySpec; this.compressionResolver = compressionResolver; this.requiresUnpack.include(Specs.satisfyNone()); - configureExclusions(); } void configureManifest(Manifest manifest, String mainClass, String classes, String lib, String classPathIndex, @@ -149,15 +146,6 @@ class BootArchiveSupport { this.requiresUnpack.include(spec); } - boolean isExcludeDevtools() { - return this.excludeDevtools; - } - - void setExcludeDevtools(boolean excludeDevtools) { - this.excludeDevtools = excludeDevtools; - configureExclusions(); - } - void excludeNonZipLibraryFiles(FileCopyDetails details) { if (this.librarySpec.isSatisfiedBy(details)) { excludeNonZipFiles(details); @@ -190,14 +178,6 @@ class BootArchiveSupport { return true; } - private void configureExclusions() { - Set excludes = new HashSet<>(); - if (this.excludeDevtools) { - excludes.add("**/spring-boot-devtools-*.jar"); - } - this.exclusions.setExcludes(excludes); - } - void moveModuleInfoToRoot(CopySpec spec) { spec.filesMatching("module-info.class", BootArchiveSupport::moveToRoot); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index a853e245ba..adf3a0968e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,6 @@ import java.util.concurrent.Callable; import java.util.function.Function; import org.gradle.api.Action; -import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ResolvableDependencies; import org.gradle.api.file.CopySpec; import org.gradle.api.file.FileCollection; @@ -128,18 +126,6 @@ public class BootJar extends Jar implements BootArchive { return this.support.createCopyAction(this); } - /** - * Returns the {@link Configuration Configurations} of the project associated with - * this task. - * @return the configurations - * @deprecated since 2.3.5 in favor of {@link Project#getConfigurations} - */ - @Internal - @Deprecated - protected Iterable getConfigurations() { - return getProject().getConfigurations(); - } - @Override public Property getMainClass() { return this.mainClass; @@ -232,18 +218,6 @@ public class BootJar extends Jar implements BootArchive { this.classpath = getProject().files(classpath); } - @Override - @Deprecated - public boolean isExcludeDevtools() { - return this.support.isExcludeDevtools(); - } - - @Override - @Deprecated - public void setExcludeDevtools(boolean excludeDevtools) { - this.support.setExcludeDevtools(excludeDevtools); - } - /** * Returns a {@code CopySpec} that can be used to add content to the {@code BOOT-INF} * directory of the jar. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index 2e23560ada..ddeac3b6f1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -169,18 +169,6 @@ public class BootWar extends War implements BootArchive { this.providedClasspath = getProject().files(classpath); } - @Override - @Deprecated - public boolean isExcludeDevtools() { - return this.support.isExcludeDevtools(); - } - - @Override - @Deprecated - public void setExcludeDevtools(boolean excludeDevtools) { - this.support.setExcludeDevtools(excludeDevtools); - } - /** * Return the {@link ZipCompression} that should be used when adding the file * represented by the given {@code details} to the jar. By default, any diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java index 965a66b6c1..6582953e56 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -369,19 +369,6 @@ abstract class AbstractBootArchiveTests { } } - @Test - @Deprecated - void devtoolsJarCanBeIncluded() throws IOException { - this.task.getMainClass().set("com.example.Main"); - this.task.classpath(jarFile("spring-boot-devtools-0.1.2.jar")); - this.task.setExcludeDevtools(false); - executeTask(); - assertThat(this.task.getArchiveFile().get().getAsFile()).exists(); - try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) { - assertThat(jarFile.getEntry(this.libPath + "spring-boot-devtools-0.1.2.jar")).isNotNull(); - } - } - @Test void allEntriesUseUnixPlatformAndUtf8NameEncoding() throws IOException { this.task.getMainClass().set("com.example.Main"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java index 1b234633e7..23cdeaec66 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,18 +80,6 @@ class BootWarTests extends AbstractBootArchiveTests { } } - @Test - @Deprecated - void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath() throws IOException { - getTask().getMainClass().set("com.example.Main"); - getTask().providedClasspath(jarFile("spring-boot-devtools-0.1.2.jar")); - getTask().setExcludeDevtools(false); - executeTask(); - try (JarFile jarFile = new JarFile(getTask().getArchiveFile().get().getAsFile())) { - assertThat(jarFile.getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar")).isNotNull(); - } - } - @Test void webappResourcesInDirectoriesThatOverlapWithLoaderCanBePackaged() throws IOException { File webappDirectory = new File(this.temp, "src/main/webapp"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java index 0634f8dff3..8ab82269e5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layout.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,20 +42,7 @@ public interface Layout { * @return the location of the library relative to the root of the archive (should end * with '/') or {@code null} if the library should not be included. */ - default String getLibraryLocation(String libraryName, LibraryScope scope) { - return getLibraryDestination(libraryName, scope); - } - - /** - * Returns the destination path for a given library. - * @param libraryName the name of the library (excluding any path) - * @param scope the scope of the library - * @return the destination relative to the root of the archive (should end with '/') - * or {@code null} if the library should not be included. - * @deprecated since 2.3.0 in favor of {@link #getLibraryLocation} - */ - @Deprecated - String getLibraryDestination(String libraryName, LibraryScope scope); + String getLibraryLocation(String libraryName, LibraryScope scope); /** * Returns the location of classes within the archive. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java index 02b1c3729b..2dc5af0c86 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,12 +73,6 @@ public final class Layouts { return "BOOT-INF/lib/"; } - @Deprecated - @Override - public String getLibraryDestination(String libraryName, LibraryScope scope) { - return "BOOT-INF/lib/"; - } - @Override public String getClassesLocation() { return ""; @@ -161,12 +155,6 @@ public final class Layouts { return SCOPE_LOCATION.get(scope); } - @Deprecated - @Override - public String getLibraryDestination(String libraryName, LibraryScope scope) { - return SCOPE_LOCATION.get(scope); - } - @Override public String getClassesLocation() { return "WEB-INF/classes/"; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index 2c1833be15..83ec65ed16 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -175,16 +175,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { @Parameter(property = "spring-boot.run.main-class") private String mainClass; - /** - * Additional directories besides the classes directory that should be added to the - * classpath. - * @since 1.0.0 - * @deprecated since 2.3.0 in favor of {@code directories} - */ - @Deprecated - @Parameter(property = "spring-boot.run.folders") - private String[] folders; - /** * Additional directories besides the classes directory that should be added to the * classpath. @@ -462,11 +452,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { } private void addUserDefinedDirectories(List urls) throws MalformedURLException { - if (this.folders != null) { - for (String folder : this.folders) { - urls.add(new File(folder).toURI().toURL()); - } - } if (this.directories != null) { for (String directory : this.directories) { urls.add(new File(directory).toURI().toURL()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index b8424d29d6..9d6bb30bb5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -423,7 +423,7 @@ public class SpringApplication { // Not allowed in some environments. } } - refresh((ApplicationContext) context); + refresh(context); } private void configureHeadlessProperty() { @@ -747,18 +747,6 @@ public class SpringApplication { return new BeanDefinitionLoader(registry, sources); } - /** - * Refresh the underlying {@link ApplicationContext}. - * @param applicationContext the application context to refresh - * @deprecated since 2.3.0 in favor of - * {@link #refresh(ConfigurableApplicationContext)} - */ - @Deprecated - protected void refresh(ApplicationContext applicationContext) { - Assert.isInstanceOf(ConfigurableApplicationContext.class, applicationContext); - refresh((ConfigurableApplicationContext) applicationContext); - } - /** * Refresh the underlying {@link ApplicationContext}. * @param applicationContext the application context to refresh diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java index 4c8c511f90..dca13a3eb3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import io.undertow.Undertow.Builder; import io.undertow.server.HttpHandler; import io.undertow.servlet.api.DeploymentManager; -import org.springframework.boot.web.server.Compression; import org.springframework.boot.web.server.WebServer; import org.springframework.util.StringUtils; @@ -44,58 +43,6 @@ public class UndertowServletWebServer extends UndertowWebServer { private final DeploymentManager manager; - /** - * Create a new {@link UndertowServletWebServer} instance. - * @param builder the builder - * @param manager the deployment manager - * @param contextPath the root context path - * @param autoStart if the server should be started - * @param compression compression configuration - * @deprecated since 2.3.0 in favor of - * {@link #UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)} - */ - @Deprecated - public UndertowServletWebServer(Builder builder, DeploymentManager manager, String contextPath, boolean autoStart, - Compression compression) { - this(builder, manager, contextPath, false, autoStart, compression); - } - - /** - * Create a new {@link UndertowServletWebServer} instance. - * @param builder the builder - * @param manager the deployment manager - * @param contextPath the root context path - * @param useForwardHeaders if x-forward headers should be used - * @param autoStart if the server should be started - * @param compression compression configuration - * @deprecated since 2.3.0 in favor of - * {@link #UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)} - */ - @Deprecated - public UndertowServletWebServer(Builder builder, DeploymentManager manager, String contextPath, - boolean useForwardHeaders, boolean autoStart, Compression compression) { - this(builder, manager, contextPath, useForwardHeaders, autoStart, compression, null); - } - - /** - * Create a new {@link UndertowServletWebServer} instance. - * @param builder the builder - * @param manager the deployment manager - * @param contextPath the root context path - * @param useForwardHeaders if x-forward headers should be used - * @param autoStart if the server should be started - * @param compression compression configuration - * @param serverHeader string to be used in HTTP header - * @deprecated since 2.3.0 in favor of - * {@link #UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)} - */ - @Deprecated - public UndertowServletWebServer(Builder builder, DeploymentManager manager, String contextPath, - boolean useForwardHeaders, boolean autoStart, Compression compression, String serverHeader) { - this(builder, UndertowWebServerFactoryDelegate.createHttpHandlerFactories(compression, useForwardHeaders, - serverHeader, null, new DeploymentManagerHttpHandlerFactory(manager)), contextPath, autoStart); - } - /** * Create a new {@link UndertowServletWebServer} instance. * @param builder the builder diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java index 5278bf6920..f1e8c28adb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java @@ -83,21 +83,7 @@ public class UndertowWebServer implements WebServer { * @param autoStart if the server should be started */ public UndertowWebServer(Undertow.Builder builder, boolean autoStart) { - this(builder, autoStart, null); - } - - /** - * Create a new {@link UndertowWebServer} instance. - * @param builder the builder - * @param autoStart if the server should be started - * @param closeable called when the server is stopped - * @since 2.0.4 - * @deprecated since 2.3.0 in favor of - * {@link #UndertowWebServer(io.undertow.Undertow.Builder, Iterable, boolean)} - */ - @Deprecated - public UndertowWebServer(Undertow.Builder builder, boolean autoStart, Closeable closeable) { - this(builder, Collections.singleton(new CloseableHttpHandlerFactory(closeable)), autoStart); + this(builder, Collections.singleton(new CloseableHttpHandlerFactory(null)), autoStart); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java index 6210c5ce8c..c96b4376e5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,32 +63,9 @@ public class DefaultErrorAttributes implements ErrorAttributes { private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName() + ".ERROR"; - private final Boolean includeException; - - /** - * Create a new {@link DefaultErrorAttributes} instance. - */ - public DefaultErrorAttributes() { - this.includeException = null; - } - - /** - * Create a new {@link DefaultErrorAttributes} instance. - * @param includeException whether to include the "exception" attribute - * @deprecated since 2.3.0 in favor of - * {@link ErrorAttributeOptions#including(Include...)} - */ - @Deprecated - public DefaultErrorAttributes(boolean includeException) { - this.includeException = includeException; - } - @Override public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { Map errorAttributes = getErrorAttributes(request, options.isIncluded(Include.STACK_TRACE)); - if (Boolean.TRUE.equals(this.includeException)) { - options = options.including(Include.EXCEPTION); - } if (!options.isIncluded(Include.EXCEPTION)) { errorAttributes.remove("exception"); } @@ -104,9 +81,7 @@ public class DefaultErrorAttributes implements ErrorAttributes { return errorAttributes; } - @Override - @Deprecated - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { + private Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { Map errorAttributes = new LinkedHashMap<>(); errorAttributes.put("timestamp", new Date()); errorAttributes.put("path", request.path()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java index c1cd5d707e..73b10af548 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/ErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.Map; import org.springframework.boot.web.error.ErrorAttributeOptions; -import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.server.ServerWebExchange; @@ -35,20 +34,6 @@ import org.springframework.web.server.ServerWebExchange; */ public interface ErrorAttributes { - /** - * Return a {@link Map} of the error attributes. The map can be used as the model of - * an error page, or returned as a {@link ServerResponse} body. - * @param request the source request - * @param includeStackTrace if stack trace attribute should be included - * @return a map of error attributes - * @deprecated since 2.3.0 in favor of - * {@link #getErrorAttributes(ServerRequest, ErrorAttributeOptions)} - */ - @Deprecated - default Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { - return Collections.emptyMap(); - } - /** * Return a {@link Map} of the error attributes. The map can be used as the model of * an error page, or returned as a {@link ServerResponse} body. @@ -57,7 +42,7 @@ public interface ErrorAttributes { * @return a map of error attributes */ default Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { - return getErrorAttributes(request, options.isIncluded(Include.STACK_TRACE)); + return Collections.emptyMap(); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java index e6c5d12242..a14f599af3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,26 +70,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName() + ".ERROR"; - private final Boolean includeException; - - /** - * Create a new {@link DefaultErrorAttributes} instance. - */ - public DefaultErrorAttributes() { - this.includeException = null; - } - - /** - * Create a new {@link DefaultErrorAttributes} instance. - * @param includeException whether to include the "exception" attribute - * @deprecated since 2.3.0 in favor of - * {@link ErrorAttributeOptions#including(Include...)} - */ - @Deprecated - public DefaultErrorAttributes(boolean includeException) { - this.includeException = includeException; - } - @Override public int getOrder() { return Ordered.HIGHEST_PRECEDENCE; @@ -109,9 +89,6 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException @Override public Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { Map errorAttributes = getErrorAttributes(webRequest, options.isIncluded(Include.STACK_TRACE)); - if (Boolean.TRUE.equals(this.includeException)) { - options = options.including(Include.EXCEPTION); - } if (!options.isIncluded(Include.EXCEPTION)) { errorAttributes.remove("exception"); } @@ -127,9 +104,7 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException return errorAttributes; } - @Override - @Deprecated - public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { + private Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { Map errorAttributes = new LinkedHashMap<>(); errorAttributes.put("timestamp", new Date()); addStatus(errorAttributes, webRequest); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java index f3ae6e38c8..911fc545c1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.Map; import org.springframework.boot.web.error.ErrorAttributeOptions; -import org.springframework.boot.web.error.ErrorAttributeOptions.Include; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.ModelAndView; @@ -35,21 +34,6 @@ import org.springframework.web.servlet.ModelAndView; */ public interface ErrorAttributes { - /** - * Returns a {@link Map} of the error attributes. The map can be used as the model of - * an error page {@link ModelAndView}, or returned as a - * {@link ResponseBody @ResponseBody}. - * @param webRequest the source request - * @param includeStackTrace if stack trace element should be included - * @return a map of error attributes - * @deprecated since 2.3.0 in favor of - * {@link #getErrorAttributes(WebRequest, ErrorAttributeOptions)} - */ - @Deprecated - default Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { - return Collections.emptyMap(); - } - /** * Returns a {@link Map} of the error attributes. The map can be used as the model of * an error page {@link ModelAndView}, or returned as a @@ -60,7 +44,7 @@ public interface ErrorAttributes { * @since 2.3.0 */ default Map getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) { - return getErrorAttributes(webRequest, options.isIncluded(Include.STACK_TRACE)); + return Collections.emptyMap(); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java index 225e345d2e..dc899fa9ae 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/ErrorController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,16 +26,6 @@ import org.springframework.stereotype.Controller; * @author Scott Frederick * @since 2.0.0 */ -@FunctionalInterface public interface ErrorController { - /** - * The return value from this method is not used; the property `server.error.path` - * must be set to override the default error page path. - * @return the error path - * @deprecated since 2.3.0 in favor of setting the property `server.error.path` - */ - @Deprecated - String getErrorPath(); - } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java index ad0c061cc2..32e2214362 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,19 +164,6 @@ class DefaultErrorAttributesTests { assertThat(attributes.get("message")).isEqualTo("Test"); } - @Test - @SuppressWarnings("deprecation") - void excludeExceptionWithDeprecatedConstructor() { - RuntimeException error = new RuntimeException("Test"); - this.errorAttributes = new DefaultErrorAttributes(false); - MockServerHttpRequest request = MockServerHttpRequest.get("/test").build(); - ServerRequest serverRequest = buildServerRequest(request, error); - Map attributes = this.errorAttributes.getErrorAttributes(serverRequest, - ErrorAttributeOptions.of()); - assertThat(this.errorAttributes.getError(serverRequest)).isSameAs(error); - assertThat(attributes.get("exception")).isNull(); - } - @Test void processResponseStatusException() { RuntimeException nested = new RuntimeException("Test"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java index fd5336bab8..6a882e9b0f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -231,17 +231,6 @@ class DefaultErrorAttributesTests { assertThat(attributes.get("message")).isEqualTo("Test"); } - @Test - @SuppressWarnings("deprecation") - void excludeExceptionAttributeWithDeprecatedConstructor() { - DefaultErrorAttributes errorAttributes = new DefaultErrorAttributes(false); - RuntimeException ex = new RuntimeException("Test"); - this.request.setAttribute("javax.servlet.error.exception", ex); - Map attributes = errorAttributes.getErrorAttributes(this.webRequest, - ErrorAttributeOptions.of()); - assertThat(attributes.get("exception")).isNull(); - } - @Test void withStackTraceAttribute() { RuntimeException ex = new RuntimeException("Test");