No, RestTemplate will continue to exist (at least for now). You don't have to replace it with WebClient.
One of the main differences is RestTemplate is synchronous and blocking i.e. when you do a rest call you need to wait till the response comes back to proceed further.
But WebClient is complete opposite of this. The caller need not wait till response comes back. Instead he will be notified when there is a response.
If you need such a functionality, then yes you need to replace your Resttemplate with WebClient.
You can in fact achieve Rest template like synchronous processing in webclient using .block(). But the other way is not possible.
EDIT:
RestTemplate is marked as feature complete in future version(> 5.0) and will not have new features added going forward
Answer from pvpkiran on Stack Overflowspring - WebClient vs RestTemplate - Stack Overflow
A comparison between RestClient, WebClient, and RestTemplate libraries for calling REST APIs in Spring Boot applications including recommendations on which one is the right choice for different s
RestClient vs. WebClient vs RestTemplate - Using the suitable library to call REST API in Spring Boot
When to use Open Feign and when not?
No, RestTemplate will continue to exist (at least for now). You don't have to replace it with WebClient.
One of the main differences is RestTemplate is synchronous and blocking i.e. when you do a rest call you need to wait till the response comes back to proceed further.
But WebClient is complete opposite of this. The caller need not wait till response comes back. Instead he will be notified when there is a response.
If you need such a functionality, then yes you need to replace your Resttemplate with WebClient.
You can in fact achieve Rest template like synchronous processing in webclient using .block(). But the other way is not possible.
EDIT:
RestTemplate is marked as feature complete in future version(> 5.0) and will not have new features added going forward
According to the Java Doc the RestTemplate will be in maintenance mode. Spring team advise to use the WebClient if possible:
NOTE: As of 5.0, the non-blocking, reactive org.springframework.web.reactive.client.WebClient offers a modern alternative to the RestTemplate with efficient support for both sync and async, as well as streaming scenarios. The RestTemplate will be deprecated in a future version and will not have major new features added going forward.
Choosing the Right Library for REST API Calls in Spring Boot: RestClient vs. WebClient vs. RestTemplate https://digma.ai/blog/restclient-vs-webclient-vs-resttemplate/