openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
254 stars 75 forks source link

Refactor `RestTemplate` to `WebClient` or `RestClient` #71

Open shanman190 opened 3 years ago

shanman190 commented 3 years ago

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

pway99 commented 3 years ago

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

shanman190 commented 3 years ago

@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 commented 1 year ago

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

varaprasadh2 commented 1 month ago

do we know an approximate ETA for this?