mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-21 05:09:13 +00:00
Deprecate RestTemplate and related types
As announced in "the state of HTTP clients in Spring" blog post (https://spring.io/blog/2025/09/30/the-state-of-http-clients-in-spring), the deprecation timeline for `RestTemplate` was announced last November and docs were updated accordingly. This commit `@Deprecate` `RestTemplate` and related types for removal to send a stronger signal to our community. The actual removal is scheduled for Spring Framework 8.0 (not yet scheduled). Closes gh-36574
This commit is contained in:
+1
@@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class InterceptingHttpAccessorTests {
|
||||
|
||||
@Test
|
||||
|
||||
+1
@@ -57,6 +57,7 @@ import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
||||
* Tests for {@link DefaultResponseErrorHandler} handling of specific
|
||||
* HTTP status codes.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class DefaultResponseErrorHandlerHttpStatusTests {
|
||||
|
||||
private final DefaultResponseErrorHandler handler = new DefaultResponseErrorHandler();
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ import static org.mockito.Mockito.mock;
|
||||
* @author Juergen Hoeller
|
||||
* @author Denys Ivano
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class DefaultResponseErrorHandlerTests {
|
||||
|
||||
private final DefaultResponseErrorHandler handler = new DefaultResponseErrorHandler();
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock;
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
@SuppressWarnings("removal")
|
||||
class ExtractingResponseErrorHandlerTests {
|
||||
|
||||
private ExtractingResponseErrorHandler errorHandler;
|
||||
|
||||
+1
@@ -52,6 +52,7 @@ import static org.mockito.Mockito.mock;
|
||||
* @author Brian Clozel
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class HttpMessageConverterExtractorTests {
|
||||
|
||||
private final HttpMessageConverter<String> converter = mock();
|
||||
|
||||
@@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
*/
|
||||
class RestClientBuilderTests {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "removal"})
|
||||
@Test
|
||||
void createFromRestTemplate() {
|
||||
JettyClientHttpRequestFactory requestFactory = new JettyClientHttpRequestFactory();
|
||||
@@ -90,6 +90,7 @@ class RestClientBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void defaultUriBuilderFactory() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
|
||||
+1
@@ -82,6 +82,7 @@ import static org.springframework.http.MediaType.MULTIPART_MIXED;
|
||||
* @author Brian Clozel
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ import static org.springframework.http.HttpMethod.GET;
|
||||
* Tests for the client HTTP observations with {@link RestTemplate}.
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
class RestTemplateObservationTests {
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ import static org.springframework.http.MediaType.parseMediaType;
|
||||
* @author Brian Clozel
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "removal"})
|
||||
class RestTemplateTests {
|
||||
|
||||
private final ClientHttpRequestFactory requestFactory = mock();
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@SuppressWarnings("JUnitMalformedDeclaration")
|
||||
@SuppressWarnings({"JUnitMalformedDeclaration", "removal"})
|
||||
class RestClientAdapterTests {
|
||||
|
||||
private final MockWebServer anotherServer = new MockWebServer();
|
||||
|
||||
Reference in New Issue
Block a user