Skip to content

Commit

Permalink
Remove deprecated code in Spring Boot 2.3
Browse files Browse the repository at this point in the history
Closes gh-24806
  • Loading branch information
snicoll committed Jan 15, 2021
2 parents 4b0d5c3 + 2c2c160 commit 2de8c49
Show file tree
Hide file tree
Showing 77 changed files with 231 additions and 2,739 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -93,17 +93,6 @@ public static MeterValue valueOf(String value) {
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -20,7 +20,6 @@
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;

/**
Expand Down Expand Up @@ -262,12 +261,6 @@ public Map<String, double[]> getPercentiles() {
return this.percentiles;
}

@Deprecated
@DeprecatedConfigurationProperty(replacement = "management.metrics.distribution.slo")
public Map<String, ServiceLevelObjectiveBoundary[]> getSla() {
return this.slo;
}

public Map<String, ServiceLevelObjectiveBoundary[]> getSlo() {
return this.slo;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -203,15 +203,6 @@ void configureWhenAllPercentilesSetShouldSetPercentilesToValue() {
.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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -128,13 +128,12 @@ public Throwable getError(WebRequest webRequest) {
}

@Test
void errorResponseWithDefaultErrorAttributesSubclassUsingDeprecatedApiAndDelegation() {
void errorResponseWithDefaultErrorAttributesSubclassUsingDelegation() {
ErrorAttributes attributes = new DefaultErrorAttributes() {

@Override
@SuppressWarnings("deprecation")
public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) {
Map<String, Object> response = super.getErrorAttributes(webRequest, includeStackTrace);
public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
Map<String, Object> response = super.getErrorAttributes(webRequest, options);
response.put("error", "custom error");
response.put("custom", "value");
response.remove("path");
Expand All @@ -151,7 +150,7 @@ public Map<String, Object> getErrorAttributes(WebRequest webRequest, boolean inc
}

@Test
void errorResponseWithDefaultErrorAttributesSubclassUsingDeprecatedApiWithoutDelegation() {
void errorResponseWithDefaultErrorAttributesSubclassWithoutDelegation() {
ErrorAttributes attributes = new DefaultErrorAttributes() {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -104,22 +104,6 @@ private CachedResponse createCachedResponse(Object response, long accessTime) {
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -94,30 +94,6 @@ public static Tag status(ClientResponse response, Throwable throwable) {
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
Expand Down
1 change: 0 additions & 1 deletion spring-boot-project/spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ dependencies {
optional("org.apache.tomcat.embed:tomcat-embed-el")
optional("org.apache.tomcat.embed:tomcat-embed-websocket")
optional("org.apache.tomcat:tomcat-jdbc")
optional("org.codehaus.btm:btm")
optional("org.codehaus.groovy:groovy-templates")
optional("com.github.ben-manes.caffeine:caffeine")
optional("com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -39,20 +39,16 @@
* 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<CouchbaseCacheManagerBuilderCustomizer> couchbaseCacheManagerBuilderCustomizers,
CouchbaseClientFactory clientFactory) {
List<String> cacheNames = cacheProperties.getCacheNames();
Expand Down
Loading

0 comments on commit 2de8c49

Please sign in to comment.