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:
Brian Clozel
2026-03-31 12:28:44 +02:00
parent 7473cd5fbc
commit 83c2afb643
35 changed files with 91 additions and 10 deletions
@@ -53,7 +53,10 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrame;
*
* @author Rossen Stoyanchev
* @since 4.1
* @deprecated as of 7.1 in favor of {@link RestClientXhrTransport}.
*/
@Deprecated(since = "7.1", forRemoval = true)
@SuppressWarnings("removal")
public class RestTemplateXhrTransport extends AbstractXhrTransport {
private final RestOperations restTemplate;
@@ -67,6 +67,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
*
* @author Rossen Stoyanchev
*/
@SuppressWarnings("removal")
class RestTemplateXhrTransportTests {
private static final JacksonJsonSockJsMessageCodec CODEC = new JacksonJsonSockJsMessageCodec();
@@ -201,6 +202,7 @@ class RestTemplateXhrTransportTests {
}
@SuppressWarnings("removal")
private static class TestRestTemplate extends RestTemplate {
private Queue<ClientHttpResponse> responses = new LinkedBlockingDeque<>();