diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java index 3169348aa9b..e671c3b4482 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java @@ -21,7 +21,6 @@ import java.time.Duration; import io.micrometer.statsd.StatsdFlavor; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; /** * {@link ConfigurationProperties} for configuring StatsD metrics export. @@ -65,11 +64,6 @@ public class StatsdProperties { */ private Duration pollingFrequency = Duration.ofSeconds(10); - /** - * Maximum size of the queue of items waiting to be sent to the StatsD server. - */ - private Integer queueSize = Integer.MAX_VALUE; - /** * Whether to send unchanged meters to the StatsD server. */ @@ -123,17 +117,6 @@ public class StatsdProperties { this.pollingFrequency = pollingFrequency; } - @Deprecated - @DeprecatedConfigurationProperty(reason = "No longer configurable and an unbounded queue will always be used") - public Integer getQueueSize() { - return this.queueSize; - } - - @Deprecated - public void setQueueSize(Integer queueSize) { - this.queueSize = queueSize; - } - public boolean isPublishUnchangedMeters() { return this.publishUnchangedMeters; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java index c62b2c9b84c..c53df2e470c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java @@ -73,12 +73,6 @@ public class StatsdPropertiesConfigAdapter StatsdConfig.super::pollingFrequency); } - @Override - @Deprecated - public int queueSize() { - return get(StatsdProperties::getQueueSize, StatsdConfig.super::queueSize); - } - @Override public boolean publishUnchangedMeters() { return get(StatsdProperties::isPublishUnchangedMeters, diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java deleted file mode 100644 index a8e7bf7c97e..00000000000 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java +++ /dev/null @@ -1,150 +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.metrics.web.reactive.server; - -import java.util.concurrent.TimeUnit; -import java.util.function.BiFunction; - -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Tag; -import io.micrometer.core.instrument.Tags; -import reactor.core.publisher.Mono; - -import org.springframework.util.Assert; -import org.springframework.web.reactive.function.server.HandlerFilterFunction; -import org.springframework.web.reactive.function.server.HandlerFunction; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.reactive.function.server.ServerResponse; - -/** - * Support class for WebFlux {@link RouterFunction}-related metrics. - * - * @author Jon Schneider - * @since 2.0.0 - * @deprecated in favor of the auto-configured {@link MetricsWebFilter} - */ -@Deprecated -public class RouterFunctionMetrics { - - private final MeterRegistry registry; - - private final BiFunction> defaultTags; - - public RouterFunctionMetrics(MeterRegistry registry) { - Assert.notNull(registry, "Registry must not be null"); - this.registry = registry; - this.defaultTags = this::defaultTags; - } - - private RouterFunctionMetrics(MeterRegistry registry, - BiFunction> defaultTags) { - Assert.notNull(registry, "Registry must not be null"); - Assert.notNull(defaultTags, "DefaultTags must not be null"); - this.registry = registry; - this.defaultTags = defaultTags; - } - - private Iterable defaultTags(ServerRequest request, ServerResponse response) { - if (response == null) { - return Tags.of(getMethodTag(request)); - } - return Tags.of(getMethodTag(request), getStatusTag(response)); - } - - /** - * Returns a new {@link RouterFunctionMetrics} instance with the specified default - * tags. - * @param defaultTags Generate a list of tags to apply to the timer. - * {@code ServerResponse} may be null. - * @return {@code this} for further configuration - */ - public RouterFunctionMetrics defaultTags( - BiFunction> defaultTags) { - return new RouterFunctionMetrics(this.registry, defaultTags); - } - - public HandlerFilterFunction timer(String name) { - return timer(name, Tags.empty()); - } - - public HandlerFilterFunction timer(String name, - String... tags) { - return timer(name, Tags.of(tags)); - } - - public HandlerFilterFunction timer(String name, - Iterable tags) { - return new MetricsFilter(name, Tags.of(tags)); - } - - /** - * Creates a {@code method} tag from the method of the given {@code request}. - * @param request The HTTP request. - * @return A "method" tag whose value is a capitalized method (e.g. GET). - */ - public static Tag getMethodTag(ServerRequest request) { - return Tag.of("method", request.method().toString()); - } - - /** - * Creates a {@code status} tag from the status of the given {@code response}. - * @param response The HTTP response. - * @return A "status" tag whose value is the numeric status code. - */ - public static Tag getStatusTag(ServerResponse response) { - return Tag.of("status", response.statusCode().toString()); - } - - /** - * {@link HandlerFilterFunction} to handle calling micrometer. - */ - private class MetricsFilter - implements HandlerFilterFunction { - - private final String name; - - private final Tags tags; - - MetricsFilter(String name, Tags tags) { - this.name = name; - this.tags = tags; - } - - @Override - public Mono filter(ServerRequest request, - HandlerFunction next) { - long start = System.nanoTime(); - return next.handle(request) - .doOnSuccess((response) -> timer(start, request, response)) - .doOnError((error) -> timer(start, request, null)); - } - - private Iterable getDefaultTags(ServerRequest request, - ServerResponse response) { - return RouterFunctionMetrics.this.defaultTags.apply(request, response); - } - - private void timer(long start, ServerRequest request, ServerResponse response) { - Tags allTags = this.tags.and(getDefaultTags(request, response)); - RouterFunctionMetrics.this.registry.timer(this.name, allTags) - .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseConfiguration.java index 567cddc869f..fafcb01ee5c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseConfiguration.java @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.couchbase; import java.util.List; -import java.util.function.BiFunction; import com.couchbase.client.core.env.KeyValueServiceConfig; import com.couchbase.client.core.env.QueryServiceConfig; @@ -29,7 +28,6 @@ import com.couchbase.client.java.cluster.ClusterInfo; import com.couchbase.client.java.env.DefaultCouchbaseEnvironment; import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties.Endpoints; -import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties.Endpoints.CouchbaseService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; @@ -129,25 +127,14 @@ public class CouchbaseConfiguration { return builder; } - @SuppressWarnings("deprecation") private QueryServiceConfig getQueryServiceConfig(Endpoints endpoints) { - return getServiceConfig(endpoints.getQueryservice(), endpoints.getQuery(), - QueryServiceConfig::create); + return QueryServiceConfig.create(endpoints.getQueryservice().getMinEndpoints(), + endpoints.getQueryservice().getMaxEndpoints()); } - @SuppressWarnings("deprecation") private ViewServiceConfig getViewServiceConfig(Endpoints endpoints) { - return getServiceConfig(endpoints.getViewservice(), endpoints.getView(), - ViewServiceConfig::create); - } - - private T getServiceConfig(CouchbaseService service, Integer fallback, - BiFunction factory) { - if (service.getMinEndpoints() != 1 || service.getMaxEndpoints() != 1) { - return factory.apply(service.getMinEndpoints(), service.getMaxEndpoints()); - } - int endpoints = (fallback != null ? fallback : 1); - return factory.apply(endpoints, endpoints); + return ViewServiceConfig.create(endpoints.getViewservice().getMinEndpoints(), + endpoints.getViewservice().getMaxEndpoints()); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java index 62c0b5c6055..1591b173263 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java @@ -20,7 +20,6 @@ import java.time.Duration; import java.util.List; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.util.StringUtils; /** @@ -128,16 +127,6 @@ public class CouchbaseProperties { */ private final CouchbaseService viewservice = new CouchbaseService(); - /** - * Number of sockets per node against the query (N1QL) service. - */ - private Integer query; - - /** - * Number of sockets per node against the view service. - */ - private Integer view; - public int getKeyValue() { return this.keyValue; } @@ -146,32 +135,10 @@ public class CouchbaseProperties { this.keyValue = keyValue; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.couchbase.env.endpoints.queryservice.max-endpoints") - public Integer getQuery() { - return this.query; - } - - @Deprecated - public void setQuery(Integer query) { - this.query = query; - } - public CouchbaseService getQueryservice() { return this.queryservice; } - @Deprecated - @DeprecatedConfigurationProperty(replacement = "spring.couchbase.env.endpoints.viewservice.max-endpoints") - public Integer getView() { - return this.view; - } - - @Deprecated - public void setView(Integer view) { - this.view = view; - } - public CouchbaseService getViewservice() { return this.viewservice; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java index 8b21be88dbe..f1f560fc12b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java @@ -37,18 +37,6 @@ public class HibernateSettings { return this; } - /** - * Specify the default ddl auto value to use. - * @param ddlAuto the default ddl auto if none is provided - * @return this instance - * @see #ddlAuto(Supplier) - * @deprecated as of 2.0.1 in favour of {@link #ddlAuto(Supplier)} - */ - @Deprecated - public HibernateSettings ddlAuto(String ddlAuto) { - return ddlAuto(() -> ddlAuto); - } - public String getDdlAuto() { return (this.ddlAuto != null ? this.ddlAuto.get() : null); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java index 411131ea691..9471a68249a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfigurationTests.java @@ -96,18 +96,6 @@ public class CouchbaseAutoConfigurationTests { "spring.couchbase.env.endpoints.viewservice.max-endpoints=6"); } - @Test - @Deprecated - public void customizeEnvEndpointsWithDeprecatedProperties() { - testCouchbaseEnv((env) -> { - assertThat(env.queryServiceConfig().minEndpoints()).isEqualTo(3); - assertThat(env.queryServiceConfig().maxEndpoints()).isEqualTo(3); - assertThat(env.viewServiceConfig().minEndpoints()).isEqualTo(4); - assertThat(env.viewServiceConfig().maxEndpoints()).isEqualTo(4); - }, "spring.couchbase.env.endpoints.query=3", - "spring.couchbase.env.endpoints.view=4"); - } - @Test public void customizeEnvEndpointsUsesNewInfrastructure() { testCouchbaseEnv((env) -> { @@ -115,10 +103,8 @@ public class CouchbaseAutoConfigurationTests { assertThat(env.queryServiceConfig().maxEndpoints()).isEqualTo(5); assertThat(env.viewServiceConfig().minEndpoints()).isEqualTo(4); assertThat(env.viewServiceConfig().maxEndpoints()).isEqualTo(6); - }, "spring.couchbase.env.endpoints.query=33", - "spring.couchbase.env.endpoints.queryservice.min-endpoints=3", + }, "spring.couchbase.env.endpoints.queryservice.min-endpoints=3", "spring.couchbase.env.endpoints.queryservice.max-endpoints=5", - "spring.couchbase.env.endpoints.view=44", "spring.couchbase.env.endpoints.viewservice.min-endpoints=4", "spring.couchbase.env.endpoints.viewservice.max-endpoints=6"); } @@ -130,9 +116,7 @@ public class CouchbaseAutoConfigurationTests { assertThat(env.queryServiceConfig().maxEndpoints()).isEqualTo(5); assertThat(env.viewServiceConfig().minEndpoints()).isEqualTo(1); assertThat(env.viewServiceConfig().maxEndpoints()).isEqualTo(6); - }, "spring.couchbase.env.endpoints.query=33", - "spring.couchbase.env.endpoints.queryservice.max-endpoints=5", - "spring.couchbase.env.endpoints.view=44", + }, "spring.couchbase.env.endpoints.queryservice.max-endpoints=5", "spring.couchbase.env.endpoints.viewservice.max-endpoints=6"); } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java deleted file mode 100644 index 0d6e87358c6..00000000000 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/EnvironmentTestUtils.java +++ /dev/null @@ -1,105 +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.test.util; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.MutablePropertySources; - -/** - * Test utilities for setting environment values. - * - * @author Dave Syer - * @author Stephane Nicoll - * @since 1.4.0 - * @deprecated since 2.0.0 in favor of {@link TestPropertyValues} - */ -@Deprecated -public abstract class EnvironmentTestUtils { - - /** - * Add additional (high priority) values to an {@link Environment} owned by an - * {@link ApplicationContext}. Name-value pairs can be specified with colon (":") or - * equals ("=") separators. - * @param context the context with an environment to modify - * @param pairs the name:value pairs - */ - public static void addEnvironment(ConfigurableApplicationContext context, - String... pairs) { - addEnvironment(context.getEnvironment(), pairs); - } - - /** - * Add additional (high priority) values to an {@link Environment}. Name-value pairs - * can be specified with colon (":") or equals ("=") separators. - * @param environment the environment to modify - * @param pairs the name:value pairs - */ - public static void addEnvironment(ConfigurableEnvironment environment, - String... pairs) { - addEnvironment("test", environment, pairs); - } - - /** - * Add additional (high priority) values to an {@link Environment}. Name-value pairs - * can be specified with colon (":") or equals ("=") separators. - * @param environment the environment to modify - * @param name the property source name - * @param pairs the name:value pairs - */ - public static void addEnvironment(String name, ConfigurableEnvironment environment, - String... pairs) { - MutablePropertySources sources = environment.getPropertySources(); - Map map = getOrAdd(sources, name); - for (String pair : pairs) { - int index = getSeparatorIndex(pair); - String key = (index > 0 ? pair.substring(0, index) : pair); - String value = (index > 0 ? pair.substring(index + 1) : ""); - map.put(key.trim(), value.trim()); - } - } - - @SuppressWarnings("unchecked") - private static Map getOrAdd(MutablePropertySources sources, - String name) { - if (sources.contains(name)) { - return (Map) sources.get(name).getSource(); - } - Map map = new HashMap<>(); - sources.addFirst(new MapPropertySource(name, map)); - return map; - } - - private static int getSeparatorIndex(String pair) { - int colonIndex = pair.indexOf(':'); - int equalIndex = pair.indexOf('='); - if (colonIndex == -1) { - return equalIndex; - } - if (equalIndex == -1) { - return colonIndex; - } - return Math.min(colonIndex, equalIndex); - } - -} diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java deleted file mode 100644 index 4b57d281bb3..00000000000 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/util/EnvironmentTestUtilsTests.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2012-2017 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.test.util; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.StandardEnvironment; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link EnvironmentTestUtils}. - * - * @author Stephane Nicoll - */ -@Deprecated -public class EnvironmentTestUtilsTests { - - private final ConfigurableEnvironment environment = new StandardEnvironment(); - - @Test - public void addSimplePairEqual() { - testAddSimplePair("my.foo", "bar", "="); - } - - @Test - public void addSimplePairColon() { - testAddSimplePair("my.foo", "bar", ":"); - } - - @Test - public void addSimplePairEqualWithEqualInValue() { - testAddSimplePair("my.foo", "b=ar", "="); - } - - @Test - public void addSimplePairEqualWithColonInValue() { - testAddSimplePair("my.foo", "b:ar", "="); - } - - @Test - public void addSimplePairColonWithColonInValue() { - testAddSimplePair("my.foo", "b:ar", ":"); - } - - @Test - public void addSimplePairColonWithEqualInValue() { - testAddSimplePair("my.foo", "b=ar", ":"); - } - - @Test - public void addPairNoValue() { - String propertyName = "my.foo+bar"; - assertThat(this.environment.containsProperty(propertyName)).isFalse(); - EnvironmentTestUtils.addEnvironment(this.environment, propertyName); - assertThat(this.environment.containsProperty(propertyName)).isTrue(); - assertThat(this.environment.getProperty(propertyName)).isEqualTo(""); - } - - private void testAddSimplePair(String key, String value, String delimiter) { - assertThat(this.environment.containsProperty(key)).isFalse(); - EnvironmentTestUtils.addEnvironment(this.environment, key + delimiter + value); - assertThat(this.environment.getProperty(key)).isEqualTo(value); - } - - @Test - public void testConfigHasHigherPrecedence() { - Map map = new HashMap<>(); - map.put("my.foo", "bar"); - MapPropertySource source = new MapPropertySource("sample", map); - this.environment.getPropertySources().addFirst(source); - assertThat(this.environment.getProperty("my.foo")).isEqualTo("bar"); - EnvironmentTestUtils.addEnvironment(this.environment, "my.foo=bar2"); - assertThat(this.environment.getProperty("my.foo")).isEqualTo("bar2"); - } - -} 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 e530d7d8786..07e1fb1eef6 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 @@ -932,17 +932,6 @@ public class SpringApplication { this.mainApplicationClass = mainApplicationClass; } - /** - * Returns whether this {@link SpringApplication} is running within a web environment. - * @return {@code true} if running within a web environment, otherwise {@code false}. - * @see #setWebEnvironment(boolean) - * @deprecated since 2.0.0 in favor of {@link #getWebApplicationType()} - */ - @Deprecated - public boolean isWebEnvironment() { - return this.webApplicationType == WebApplicationType.SERVLET; - } - /** * Returns the type of web application that is being run. * @return the type of web application @@ -952,19 +941,6 @@ public class SpringApplication { return this.webApplicationType; } - /** - * Sets if this application is running within a web environment. If not specified will - * attempt to deduce the environment based on the classpath. - * @param webEnvironment if the application is running in a web environment - * @deprecated since 2.0.0 in favor of - * {@link #setWebApplicationType(WebApplicationType)} - */ - @Deprecated - public void setWebEnvironment(boolean webEnvironment) { - this.webApplicationType = (webEnvironment ? WebApplicationType.SERVLET - : WebApplicationType.NONE); - } - /** * Sets the type of web application to be run. If not explicitly set the type of web * application will be deduced based on the classpath. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index add5881052b..3d4c07157bb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -288,19 +288,6 @@ public class SpringApplicationBuilder { return this; } - /** - * Flag to explicitly request a web or non-web environment (auto detected based on - * classpath if not set). - * @param webEnvironment the flag to set - * @return the current builder - * @deprecated since 2.0.0 in favour of {@link #web(WebApplicationType)} - */ - @Deprecated - public SpringApplicationBuilder web(boolean webEnvironment) { - this.application.setWebEnvironment(webEnvironment); - return this; - } - /** * Flag to explicitly request a specific type of web application. Auto-detected based * on the classpath if not set. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java index c44b8bfe220..00ce07717d9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java @@ -17,9 +17,7 @@ package org.springframework.boot.web.servlet.server; import java.io.File; -import java.io.UnsupportedEncodingException; import java.net.URL; -import java.net.URLDecoder; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; @@ -282,23 +280,6 @@ public abstract class AbstractServletWebServerFactory return this.staticResourceJars.getUrls(); } - /** - * Converts the given {@code url} into a decoded file path. - * @param url the url to convert - * @return the file path - * @deprecated Since 2.0.2 in favor of {@link File#File(java.net.URI)} - */ - @Deprecated - protected final String getDecodedFile(URL url) { - try { - return URLDecoder.decode(url.getFile(), "UTF-8"); - } - catch (UnsupportedEncodingException ex) { - throw new IllegalStateException( - "Failed to decode '" + url.getFile() + "' using UTF-8"); - } - } - protected final File getValidSessionStoreDir() { return getValidSessionStoreDir(true); }