Quick revision
The short answer
RestTemplate is in maintenance mode: it still works and gets bug fixes, but no new features, and the Spring team has announced plans to deprecate it in a future release, so check your version. For new synchronous code we use RestClient, available since Spring Framework 6.1, which has a fluent API and shares RestTemplate's message converters and request factories, often with an HTTP interface client on top for a declarative style. WebClient remains the reactive option, but it pulls a reactive dependency into a blocking application.
What to remember
In this answer, we saw that RestTemplate is in maintenance mode, receiving fixes but no new features, with a deprecation announced for a future release. For new synchronous code, RestClient, available since Spring Framework 6.1, offers a fluent API on the same request factories, converters and interceptors, and HTTP interface clients can sit on top of it for a declarative style. WebClient remains the reactive client, but in a blocking application it adds a reactive dependency for little gain, and existing RestTemplate code can be migrated gradually with RestClient.create(restTemplate).
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
RestTemplate is in maintenance mode: it still works and gets bug fixes, but no new features, and the Spring team has announced plans to deprecate it in a future release, so check your version. For new synchronous code we use RestClient, available since Spring Framework 6.1, which has a fluent API and shares RestTemplate's message converters and request factories, often with an HTTP interface client on top for a declarative style. WebClient remains the reactive option, but it pulls a reactive dependency into a blocking application.
Why this question is asked
RestTemplate has been the default way to call HTTP services from Spring for well over a decade, so most codebases are full of it. Interviewers ask about its status to check whether we follow how Spring evolves and can pick the right client for new code without rewriting everything. In this answer, we will recap what RestTemplate is and what maintenance mode means, look at RestClient with a side-by-side example, see how HTTP interface clients build on it, explain where WebClient still fits, and finish with how to migrate existing code with the least change.
1A Quick Recap of RestTemplate and Maintenance Mode
RestTemplate is Spring's original synchronous HTTP client. It offers one method per style of call, such as getForObject, postForEntity and exchange, each with several overloads. Under the hood it delegates the actual HTTP work to a ClientHttpRequestFactory, which can be the JDK's HttpURLConnection, the JDK HttpClient, Apache HttpClient or others, and it converts bodies with HttpMessageConverters such as Jackson's.
Maintenance mode means the Spring team keeps it working and fixes bugs, but adds no new features to it; new ideas go into RestClient instead. The team has also announced that RestTemplate will be formally deprecated in a future Spring Framework release and removed later. The exact releases are set by the Spring team's plans, so check your version's documentation before quoting a date. Existing code is not broken, but new code should not start with it.
2RestClient: The Modern Synchronous Client
RestClient arrived in Spring Framework 6.1 (Spring Boot 3.2). It is blocking, like RestTemplate, so it fits normal Spring MVC applications, but it has a fluent API in the style of WebClient. The same call in both clients makes the difference clear.
Notice that RestClient reads like a sentence: method, URI, headers, retrieve, body. There is one fluent chain instead of dozens of overloads, and error handling is configured per call with onStatus. Importantly, RestClient is built on the same infrastructure as RestTemplate: the same ClientHttpRequestFactory implementations, the same message converters and the same interceptors. That is what makes migration cheap. In Spring Boot, we inject the auto-configured RestClient.Builder, which already carries the application's message converters and observability.
3HTTP Interface Clients on Top of RestClient
For services we call often, we can go one step further and declare the API as a Java interface. Spring generates the implementation at runtime and uses RestClient to make the calls.
The calling code now depends on a small typed interface instead of on HTTP details, much like Feign clients but built into Spring. Newer Spring versions add more support for registering groups of these clients; check your version.
4Where WebClient Fits
WebClient is Spring's reactive client, part of Spring WebFlux. It returns Mono and Flux, which makes it ideal when the application itself is reactive and must not block threads. It can be used from a blocking application by calling block(), and before RestClient existed that was the recommended way to get a fluent API.
The downside in a blocking application is that it brings Project Reactor and a reactive HTTP stack such as Reactor Netty onto the classpath, plus a second programming model the team must understand, only to block on every call. With RestClient available, there is little reason to do that for new synchronous code.
| Client | Style | Status | Use for |
|---|---|---|---|
RestTemplate | Blocking, template methods | Maintenance; deprecation planned | Existing code only |
RestClient | Blocking, fluent | Current, since 6.1 | New synchronous code |
| HTTP interface | Declarative, on RestClient or WebClient | Current, since 6.0 | Frequently called services |
| WebClient | Reactive, fluent | Current | Reactive applications |
5Migrating Existing Code With the Least Change
We do not need to rewrite all RestTemplate calls at once. RestClient can be created from an existing RestTemplate, and it then reuses that template's request factory, interceptors, message converters and URI settings. So a team can start writing new calls with RestClient while sharing all its existing configuration.
Then we migrate call sites one module at a time. The main thing to test is error handling, because RestClient's onStatus handlers and RestTemplate's ResponseErrorHandler do not behave identically in every case, so 4xx and 5xx paths deserve explicit tests during the move.
6Follow-up questions
How would you migrate existing RestTemplate code with the least change?
I would create a RestClient from the existing RestTemplate with RestClient.create(restTemplate) or RestClient.builder(restTemplate), so it reuses the request factory, interceptors and converters, and then convert call sites gradually, module by module, testing the error paths. Shared configuration stays in one place, and frequently used services can be moved to HTTP interface clients along the way.
Is it wrong to keep using RestTemplate in an existing application?
No. It is supported and receives fixes, so working code can stay for now. The point is to stop adding new RestTemplate code and to plan the move before it is formally deprecated, rather than under pressure when it is removed.
Can RestClient do asynchronous calls?
Not by itself; it is synchronous. With virtual threads on Java 21 and later, blocking calls are cheap, so many applications can simply run RestClient calls on virtual threads. If the whole application is reactive, WebClient is the right client.
7Conclusion
In this answer, we saw that RestTemplate is in maintenance mode, receiving fixes but no new features, with a deprecation announced for a future release. For new synchronous code, RestClient, available since Spring Framework 6.1, offers a fluent API on the same request factories, converters and interceptors, and HTTP interface clients can sit on top of it for a declarative style. WebClient remains the reactive client, but in a blocking application it adds a reactive dependency for little gain, and existing RestTemplate code can be migrated gradually with RestClient.create(restTemplate).
Open with
RestTemplate still works and is supported, but it is in maintenance mode, so it gets bug fixes and no new features, and the Spring team has announced it will be deprecated in a future release and removed later; I would check the exact version in the docs.
Then, if they want more
For new synchronous code I use RestClient, which came in Spring Framework 6.1, so Spring Boot 3.2. It is blocking like RestTemplate, so it fits an MVC application, but has a fluent API: get, uri, header, retrieve, body, with per-call error handling through onStatus.
It uses the same request factories, message converters and interceptors as RestTemplate, and in Boot I inject the auto-configured RestClient.Builder. For services we call a lot, I put an HTTP interface on top: an annotated Java interface with @GetExchange methods that Spring implements using RestClient, which is basically Feign built into Spring.
WebClient is the reactive client; it is the right choice in a WebFlux application, but in a blocking app it brings in Reactor and Netty just to call block on every request, so I would not use it there now that RestClient exists.
For migration, RestClient.create(restTemplate) reuses all the existing configuration, so I can move call sites gradually and test the 4xx and 5xx paths as I go.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Framework 6, Java 21, Spring Boot 3.2
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What is the status of RestTemplate in current Spring versions, and what would you use...": https://scrivio-interview-library.netlify.app/spring-boot/http-clients/21bec3c0ba/