From 246111cd84862bee663c67985a0b17e338fe5cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmed=20Ba=C5=BEdar?= Date: Thu, 21 Feb 2019 10:32:53 +0100 Subject: [PATCH] Remove code deprecated in 2.1 See gh-16013 --- .../boot/actuate/endpoint/web/PathMapper.java | 11 --- .../health/CompositeHealthIndicator.java | 25 ------- .../CompositeHealthIndicatorFactory.java | 64 ----------------- .../CompositeReactiveHealthIndicator.java | 43 ------------ .../web/reactive/server/MetricsWebFilter.java | 14 ---- .../web/servlet/WebMvcMetricsFilter.java | 17 ----- .../system/DiskSpaceHealthIndicator.java | 12 ---- .../CompositeHealthIndicatorFactoryTests.java | 70 ------------------- .../batch/JobLauncherCommandLineRunner.java | 17 ----- .../DispatcherServletPathProvider.java | 36 ---------- .../boot/web/client/RestTemplateBuilder.java | 38 ---------- .../AbstractFilterRegistrationBean.java | 8 --- .../web/servlet/FilterRegistrationBean.java | 8 --- .../web/servlet/MultipartConfigFactory.java | 63 ----------------- .../web/client/RestTemplateBuilderTests.java | 14 +--- .../servlet/MultipartConfigFactoryTests.java | 28 -------- 16 files changed, 2 insertions(+), 466 deletions(-) delete mode 100644 spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactory.java delete mode 100644 spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPathProvider.java diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMapper.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMapper.java index 8eed7ea3cd..1bcab63816 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMapper.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMapper.java @@ -41,17 +41,6 @@ public interface PathMapper { */ String getRootPath(EndpointId endpointId); - /** - * Returns an {@link PathMapper} that uses the endpoint ID as the path. - * @return an {@link PathMapper} that uses the lowercase endpoint ID as the path - * @deprecated since 2.1.0 in favor of {@link #getRootPath(List, EndpointId)} with a - * {@code null} list - */ - @Deprecated - static PathMapper useEndpointId() { - return EndpointId::toString; - } - /** * Resolve the root path for the specified {@code endpointId} from the given path * mappers. If no mapper matches then the ID itself is returned. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java index 6cd60dfa44..52d880d647 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicator.java @@ -33,17 +33,6 @@ public class CompositeHealthIndicator implements HealthIndicator { private final HealthAggregator aggregator; - /** - * Create a new {@link CompositeHealthIndicator}. - * @param healthAggregator the health aggregator - * @deprecated since 2.1.0 in favor of - * {@link #CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)} - */ - @Deprecated - public CompositeHealthIndicator(HealthAggregator healthAggregator) { - this(healthAggregator, new DefaultHealthIndicatorRegistry()); - } - /** * Create a new {@link CompositeHealthIndicator} from the specified indicators. * @param healthAggregator the health aggregator @@ -67,20 +56,6 @@ public class CompositeHealthIndicator implements HealthIndicator { this.registry = registry; } - /** - * Adds the given {@code healthIndicator}, associating it with the given {@code name}. - * @param name the name of the indicator - * @param indicator the indicator - * @throws IllegalStateException if an indicator with the given {@code name} is - * already registered. - * @deprecated since 2.1.0 in favor of - * {@link HealthIndicatorRegistry#register(String, HealthIndicator)} - */ - @Deprecated - public void addHealthIndicator(String name, HealthIndicator indicator) { - this.registry.register(name, indicator); - } - /** * Return the {@link HealthIndicatorRegistry} of this instance. * @return the registry of nested {@link HealthIndicator health indicators} diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactory.java deleted file mode 100644 index f6bcc96bce..0000000000 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2012-2018 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 - * - * http://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.health; - -import java.util.Map; -import java.util.function.Function; - -import org.springframework.util.Assert; - -/** - * Factory to create a {@link CompositeHealthIndicator}. - * - * @author Stephane Nicoll - * @since 2.0.0 - * @deprecated since 2.1.0 in favor of - * {@link CompositeHealthIndicator#CompositeHealthIndicator(HealthAggregator, HealthIndicatorRegistry)} - */ -@Deprecated -public class CompositeHealthIndicatorFactory { - - private final Function healthIndicatorNameFactory; - - public CompositeHealthIndicatorFactory() { - this(new HealthIndicatorNameFactory()); - } - - public CompositeHealthIndicatorFactory( - Function healthIndicatorNameFactory) { - this.healthIndicatorNameFactory = healthIndicatorNameFactory; - } - - /** - * Create a {@link CompositeHealthIndicator} based on the specified health indicators. - * @param healthAggregator the {@link HealthAggregator} - * @param healthIndicators the {@link HealthIndicator} instances mapped by name - * @return a {@link HealthIndicator} that delegates to the specified - * {@code healthIndicators}. - */ - public CompositeHealthIndicator createHealthIndicator( - HealthAggregator healthAggregator, - Map healthIndicators) { - Assert.notNull(healthAggregator, "HealthAggregator must not be null"); - Assert.notNull(healthIndicators, "HealthIndicators must not be null"); - HealthIndicatorRegistryFactory factory = new HealthIndicatorRegistryFactory( - this.healthIndicatorNameFactory); - return new CompositeHealthIndicator(healthAggregator, - factory.createHealthIndicatorRegistry(healthIndicators)); - } - -} diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java index 007f454fcf..1b1a5dd31d 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java @@ -45,32 +45,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator private final Function, Mono> timeoutCompose; - /** - * Create a new {@link CompositeReactiveHealthIndicator}. - * @param healthAggregator the health aggregator - * @deprecated since 2.1.0 in favor of - * {@link #CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)} - */ - @Deprecated - public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator) { - this(healthAggregator, new LinkedHashMap<>()); - } - - /** - * Create a new {@link CompositeReactiveHealthIndicator} from the specified - * indicators. - * @param healthAggregator the health aggregator - * @param indicators a map of {@link ReactiveHealthIndicator HealthIndicators} with - * the key being used as an indicator name. - * @deprecated since 2.1.0 in favor of - * {@link #CompositeReactiveHealthIndicator(HealthAggregator, ReactiveHealthIndicatorRegistry)} - */ - @Deprecated - public CompositeReactiveHealthIndicator(HealthAggregator healthAggregator, - Map indicators) { - this(healthAggregator, new DefaultReactiveHealthIndicatorRegistry(indicators)); - - } /** * Create a new {@link CompositeReactiveHealthIndicator} from the indicators in the @@ -86,23 +60,6 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono; } - /** - * Add a {@link ReactiveHealthIndicator} with the specified name. - * @param name the name of the health indicator - * @param indicator the health indicator to add - * @return this instance - * @throws IllegalStateException if an indicator with the given {@code name} is - * already registered. - * @deprecated since 2.1.0 in favor of - * {@link ReactiveHealthIndicatorRegistry#register(String, ReactiveHealthIndicator)} - */ - @Deprecated - public CompositeReactiveHealthIndicator addHealthIndicator(String name, - ReactiveHealthIndicator indicator) { - this.registry.register(name, indicator); - return this; - } - /** * Specify an alternative timeout {@link Health} if a {@link HealthIndicator} failed * to reply after specified {@code timeout}. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java index 75a0c8e9c8..39e15483f9 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java @@ -48,20 +48,6 @@ public class MetricsWebFilter implements WebFilter { private final boolean autoTimeRequests; - /** - * Create a new {@code MetricsWebFilter}. - * @param registry the registry to which metrics are recorded - * @param tagsProvider provider for metrics tags - * @param metricName name of the metric to record - * @deprecated since 2.0.6 in favor of - * {@link #MetricsWebFilter(MeterRegistry, WebFluxTagsProvider, String, boolean)} - */ - @Deprecated - public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider, - String metricName) { - this(registry, tagsProvider, metricName, true); - } - public MetricsWebFilter(MeterRegistry registry, WebFluxTagsProvider tagsProvider, String metricName, boolean autoTimeRequests) { this.registry = registry; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java index b99125c0ae..f97d2c9859 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java @@ -61,23 +61,6 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter { private final boolean autoTimeRequests; - /** - * Create a new {@link WebMvcMetricsFilter} instance. - * @param context the source application context - * @param registry the meter registry - * @param tagsProvider the tags provider - * @param metricName the metric name - * @param autoTimeRequests if requests should be automatically timed - * @deprecated since 2.0.7 in favor of - * {@link #WebMvcMetricsFilter(MeterRegistry, WebMvcTagsProvider, String, boolean)} - */ - @Deprecated - public WebMvcMetricsFilter(ApplicationContext context, MeterRegistry registry, - WebMvcTagsProvider tagsProvider, String metricName, - boolean autoTimeRequests) { - this(registry, tagsProvider, metricName, autoTimeRequests); - } - /** * Create a new {@link WebMvcMetricsFilter} instance. * @param registry the meter registry diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java index 0a0e20a1a9..12cb6eca07 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java @@ -55,18 +55,6 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { this.threshold = threshold; } - /** - * Create a new {@code DiskSpaceHealthIndicator} instance. - * @param path the Path used to compute the available disk space - * @param threshold the minimum disk space that should be available (in bytes) - * @deprecated since 2.1.0 in favor of - * {@link #DiskSpaceHealthIndicator(File, DataSize)} - */ - @Deprecated - public DiskSpaceHealthIndicator(File path, long threshold) { - this(path, DataSize.ofBytes(threshold)); - } - @Override protected void doHealthCheck(Health.Builder builder) throws Exception { long diskFreeInBytes = this.path.getUsableSpace(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java deleted file mode 100644 index 0df3382d52..0000000000 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/CompositeHealthIndicatorFactoryTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2012-2018 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 - * - * http://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.health; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link CompositeHealthIndicatorFactory}. - * - * @author Phillip Webb - * @author Christian Dupuis - * @author Andy Wilkinson - */ -@Deprecated -public class CompositeHealthIndicatorFactoryTests { - - @Test - public void upAndUpIsAggregatedToUp() { - Map healthIndicators = new HashMap<>(); - healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build()); - healthIndicators.put("upAgain", - () -> new Health.Builder().status(Status.UP).build()); - HealthIndicator healthIndicator = createHealthIndicator(healthIndicators); - assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UP); - } - - @Test - public void upAndDownIsAggregatedToDown() { - Map healthIndicators = new HashMap<>(); - healthIndicators.put("up", () -> new Health.Builder().status(Status.UP).build()); - healthIndicators.put("down", - () -> new Health.Builder().status(Status.DOWN).build()); - HealthIndicator healthIndicator = createHealthIndicator(healthIndicators); - assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.DOWN); - } - - @Test - public void unknownStatusMapsToUnknown() { - Map healthIndicators = new HashMap<>(); - healthIndicators.put("status", () -> new Health.Builder().status("FINE").build()); - HealthIndicator healthIndicator = createHealthIndicator(healthIndicators); - assertThat(healthIndicator.health().getStatus()).isEqualTo(Status.UNKNOWN); - } - - private HealthIndicator createHealthIndicator( - Map healthIndicators) { - return new CompositeHealthIndicatorFactory() - .createHealthIndicator(new OrderedHealthAggregator(), healthIndicators); - } - -} 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 index 8be9ff422c..5d73490cce 100644 --- 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 @@ -93,23 +93,6 @@ public class JobLauncherCommandLineRunner private ApplicationEventPublisher publisher; - /** - * Create a new {@link JobLauncherCommandLineRunner}. - * @param jobLauncher to launch jobs - * @param jobExplorer to check the job repository for previous executions - * @deprecated since 2.0.7 in favor of - * {@link #JobLauncherCommandLineRunner(JobLauncher, JobExplorer, JobRepository)}. A - * job repository is required to check if a job instance exists with the given - * parameters when running a job (which is not possible with the job explorer). - */ - @Deprecated - public JobLauncherCommandLineRunner(JobLauncher jobLauncher, - JobExplorer jobExplorer) { - this.jobLauncher = jobLauncher; - this.jobExplorer = jobExplorer; - this.jobRepository = null; - } - /** * Create a new {@link JobLauncherCommandLineRunner}. * @param jobLauncher to launch jobs diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPathProvider.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPathProvider.java deleted file mode 100644 index 76b6fa97bb..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletPathProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2012-2018 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 - * - * http://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.web.servlet; - -import org.springframework.web.servlet.DispatcherServlet; - -/** - * Interface that provides the paths that the {@link DispatcherServlet} in an application - * context is mapped to. - * - * @author Madhura Bhave - * @since 2.0.2 - * @deprecated since 2.0.4 in favor of {@link DispatcherServletPath} and - * {@link DispatcherServletRegistrationBean} - */ -@Deprecated -@FunctionalInterface -public interface DispatcherServletPathProvider { - - String getServletPath(); - -} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 0972c7a6a6..d01e74321b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -370,20 +370,6 @@ public class RestTemplateBuilder { this.interceptors); } - /** - * Add HTTP basic authentication to requests. See - * {@link BasicAuthenticationInterceptor} for details. - * @param username the user name - * @param password the password - * @return a new builder instance - * @deprecated since 2.1.0 in favor of - * {@link #basicAuthentication(String username, String password)} - */ - @Deprecated - public RestTemplateBuilder basicAuthorization(String username, String password) { - return basicAuthentication(username, password); - } - /** * Add HTTP basic authentication to requests. See * {@link BasicAuthenticationInterceptor} for details. @@ -486,18 +472,6 @@ public class RestTemplateBuilder { this.interceptors); } - /** - * Sets the connection timeout in milliseconds on the underlying - * {@link ClientHttpRequestFactory}. - * @param connectTimeout the connection timeout in milliseconds - * @return a new builder instance. - * @deprecated since 2.1.0 in favor of {@link #setConnectTimeout(Duration)} - */ - @Deprecated - public RestTemplateBuilder setConnectTimeout(int connectTimeout) { - return setConnectTimeout(Duration.ofMillis(connectTimeout)); - } - /** * Sets the read timeout on the underlying {@link ClientHttpRequestFactory}. * @param readTimeout the read timeout @@ -513,18 +487,6 @@ public class RestTemplateBuilder { this.interceptors); } - /** - * Sets the read timeout in milliseconds on the underlying - * {@link ClientHttpRequestFactory}. - * @param readTimeout the read timeout in milliseconds - * @return a new builder instance. - * @deprecated since 2.1.0 in favor of {@link #setReadTimeout(Duration)} - */ - @Deprecated - public RestTemplateBuilder setReadTimeout(int readTimeout) { - return setReadTimeout(Duration.ofMillis(readTimeout)); - } - /** * Build a new {@link RestTemplate} instance and configure it using this builder. * @return a configured {@link RestTemplate} instance. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java index df762a5904..4f521a8ca8 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java @@ -44,14 +44,6 @@ import org.springframework.util.StringUtils; public abstract class AbstractFilterRegistrationBean extends DynamicRegistrationBean { - /** - * Filters that wrap the servlet request should be ordered less than or equal to this. - * @deprecated since 2.1.0 in favor of - * {@code OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER} - */ - @Deprecated - protected static final int REQUEST_WRAPPER_FILTER_MAX_ORDER = 0; - private static final String[] DEFAULT_URL_MAPPINGS = { "/*" }; private Set> servletRegistrationBeans = new LinkedHashSet<>(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/FilterRegistrationBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/FilterRegistrationBean.java index 08d074fddc..ded42c7a7f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/FilterRegistrationBean.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/FilterRegistrationBean.java @@ -43,14 +43,6 @@ import org.springframework.util.Assert; public class FilterRegistrationBean extends AbstractFilterRegistrationBean { - /** - * Filters that wrap the servlet request should be ordered less than or equal to this. - * @deprecated since 2.1.0 in favor of - * {@code OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER} - */ - @Deprecated - public static final int REQUEST_WRAPPER_FILTER_MAX_ORDER = AbstractFilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER; - private T filter; /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java index 2fdbf2ba2a..a45dad67f7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/MultipartConfigFactory.java @@ -54,27 +54,6 @@ public class MultipartConfigFactory { this.maxFileSize = maxFileSize; } - /** - * Sets the maximum size in bytes allowed for uploaded files. - * @param maxFileSize the maximum file size - * @deprecated since 2.1.0 in favor of {@link #setMaxFileSize(DataSize)} - */ - @Deprecated - public void setMaxFileSize(long maxFileSize) { - setMaxFileSize(DataSize.ofBytes(maxFileSize)); - } - - /** - * Sets the maximum size allowed for uploaded files. Values can use the suffixed "MB" - * or "KB" to indicate a Megabyte or Kilobyte size. - * @param maxFileSize the maximum file size - * @deprecated since 2.1.0 in favor of {@link #setMaxFileSize(DataSize)} - */ - @Deprecated - public void setMaxFileSize(String maxFileSize) { - setMaxFileSize(DataSize.parse(maxFileSize)); - } - /** * Sets the maximum {@link DataSize} allowed for multipart/form-data requests. * @param maxRequestSize the maximum request size @@ -83,27 +62,6 @@ public class MultipartConfigFactory { this.maxRequestSize = maxRequestSize; } - /** - * Sets the maximum size allowed in bytes for multipart/form-data requests. - * @param maxRequestSize the maximum request size - * @deprecated since 2.1.0 in favor of {@link #setMaxRequestSize(DataSize)} - */ - @Deprecated - public void setMaxRequestSize(long maxRequestSize) { - setMaxRequestSize(DataSize.ofBytes(maxRequestSize)); - } - - /** - * Sets the maximum size allowed for multipart/form-data requests. Values can use the - * suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. - * @param maxRequestSize the maximum request size - * @deprecated since 2.1.0 in favor of {@link #setMaxRequestSize(DataSize)} - */ - @Deprecated - public void setMaxRequestSize(String maxRequestSize) { - setMaxRequestSize(DataSize.parse(maxRequestSize)); - } - /** * Sets the {@link DataSize size} threshold after which files will be written to disk. * @param fileSizeThreshold the file size threshold @@ -112,27 +70,6 @@ public class MultipartConfigFactory { this.fileSizeThreshold = fileSizeThreshold; } - /** - * Sets the size threshold in bytes after which files will be written to disk. - * @param fileSizeThreshold the file size threshold - * @deprecated since 2.1.0 in favor of {@link #setFileSizeThreshold(DataSize)} - */ - @Deprecated - public void setFileSizeThreshold(int fileSizeThreshold) { - setFileSizeThreshold(DataSize.ofBytes(fileSizeThreshold)); - } - - /** - * Sets the size threshold after which files will be written to disk. Values can use - * the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. - * @param fileSizeThreshold the file size threshold - * @deprecated since 2.1.0 in favor of {@link #setFileSizeThreshold(DataSize)} - */ - @Deprecated - public void setFileSizeThreshold(String fileSizeThreshold) { - setFileSizeThreshold(DataSize.parse(fileSizeThreshold)); - } - /** * Create a new {@link MultipartConfigElement} instance. * @return the multipart config element diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java index 3decba3496..54e5d146c3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java @@ -332,16 +332,6 @@ public class RestTemplateBuilderTests { assertThat(interceptor).extracting("password").containsExactly("boot"); } - @Test - @Deprecated - public void basicAuthorizationShouldApply() { - RestTemplate template = this.builder.basicAuthorization("spring", "boot").build(); - ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0); - assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class); - assertThat(interceptor).extracting("username").containsExactly("spring"); - assertThat(interceptor).extracting("password").containsExactly("boot"); - } - @Test public void customizersWhenCustomizersAreNullShouldThrowException() { assertThatIllegalArgumentException() @@ -559,7 +549,7 @@ public class RestTemplateBuilderTests { public void connectTimeoutCanBeSetWithInteger() { ClientHttpRequestFactory requestFactory = this.builder .requestFactory(SimpleClientHttpRequestFactory.class) - .setConnectTimeout(1234).build().getRequestFactory(); + .setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234); } @@ -567,7 +557,7 @@ public class RestTemplateBuilderTests { @SuppressWarnings("deprecation") public void readTimeoutCanBeSetWithInteger() { ClientHttpRequestFactory requestFactory = this.builder - .requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(1234) + .requestFactory(SimpleClientHttpRequestFactory.class).setReadTimeout(Duration.ofMillis(1234)) .build().getRequestFactory(); assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java index 04d17310c4..ba1654a34b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/MultipartConfigFactoryTests.java @@ -42,34 +42,6 @@ public class MultipartConfigFactoryTests { assertThat(config.getFileSizeThreshold()).isEqualTo(0); } - @Test - @Deprecated - public void create() { - MultipartConfigFactory factory = new MultipartConfigFactory(); - factory.setLocation("loc"); - factory.setMaxFileSize(1); - factory.setMaxRequestSize(2); - factory.setFileSizeThreshold(3); - MultipartConfigElement config = factory.createMultipartConfig(); - assertThat(config.getLocation()).isEqualTo("loc"); - assertThat(config.getMaxFileSize()).isEqualTo(1L); - assertThat(config.getMaxRequestSize()).isEqualTo(2L); - assertThat(config.getFileSizeThreshold()).isEqualTo(3); - } - - @Test - @Deprecated - public void createWithStringSizes() { - MultipartConfigFactory factory = new MultipartConfigFactory(); - factory.setMaxFileSize("1"); - factory.setMaxRequestSize("2KB"); - factory.setFileSizeThreshold("3MB"); - MultipartConfigElement config = factory.createMultipartConfig(); - assertThat(config.getMaxFileSize()).isEqualTo(1L); - assertThat(config.getMaxRequestSize()).isEqualTo(2 * 1024L); - assertThat(config.getFileSizeThreshold()).isEqualTo(3 * 1024 * 1024); - } - @Test public void createWithDataSizes() { MultipartConfigFactory factory = new MultipartConfigFactory();