rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Refactor `RestTemplate` to `WebClient` or `RestClient`

Open shanman190 opened this issue 4 years ago • 4 comments

As of Spring Framework 5.0, RestTemplate has been put into maintenance mode with a recommendation to attempt to use WebClient. A refactoring rule for this would be awesome and should be fairly straightforward.

Source: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html

shanman190 avatar May 28 '21 04:05 shanman190

@shanman190 I agree this would be a handy recipe For future reference: webclient loadbalancer docs RestTemplate vs WebClient blog

pway99 avatar Jun 02 '21 15:06 pway99

@pway99, yep. I've gone through several RestTemplate -> WebClient refactors and it's by no means difficult, but it can become tedious. 😆

Those guides summarize what a recipe may entail pretty well.

shanman190 avatar Jun 03 '21 01:06 shanman190

Another option here or for a new issue would be to target the new RestClient that is coming with Spring Framework 6.1. This component will be reusing the infrastructure that has been built around RestTemplate already.

https://spring.io/blog/2023/07/13/new-in-spring-6-1-restclient

shanman190 avatar Aug 26 '23 15:08 shanman190

do we know an approximate ETA for this?

varaprasadh2 avatar Aug 21 '24 04:08 varaprasadh2