-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create migration guide from RestTemplate to RestClient #23269
Comments
That is a good idea to put together such a a resource for those only familiar with the Note that there is a section in the reference on synchronous use of the Beyond that even if not interested in "reactive", any time you need to do more than one call, there is a good chance simply blocking your way out of each call is missing the power of the |
If you'll be extending the documentations, maybe you could also go into detail on how to properly log http message body for both request and response in case of sync calls? For example in Yet I did not succeed creating the same for a WebClient, if possible at all?... |
@membersound, good question. You'd probably need to wrap at the connector in order to get to the lower level
|
Interesting approach! I think you could just as well use
It would be a plus if one could also access the Do you have a further idea how the request-body could also be intercepted within the same connector? |
Would the following be correct?
Or would I also have to override |
To correct myself: no, it's not possible to directly write the buffer out. Because the payload may be chunked and then also log chunked content. Instead, collect it inside another But I'm using |
Team Decision: This is a good idea, it needs to be done. It won't be part of the Spring Framework reference -- to avoid bloating it and also because such a guide would go beyond this projects (e.g. some parts would relate to Boot). It should rather be an independent guide, perhaps under https://github.com/spring-guides, but it makes sense to leave the ticket here for now. |
Has there been any progress on this, I could not find a guide at: https://github.com/spring-guides |
I would like to repeat @billNaylor question... Has there been any progress on this? It would be really helpful to understand in more detail how to migrate from a RestTemplate to a WebClient (especially if not switching from an imperative stack to a reactive stack). |
With Introduction of RestClient , we should be looking for RestTemplate to RestClient migration guide, since RestClient uses same underlying RestTemplate infrastructure. |
Could you add a detailed migration guide on how to refactor existing
RestTemplate
(which typically is for sync blocking requests) intoWebClient
requests (also sync and blocking)?Because the usual case for WebClient is probably for async requests, but chances are high that if someone refactors to
WebClient
he want's to stick to his synchronous patterns.Wouldn't this be a good idea to grab spring users by their hands just now, if it's planned to deprecate
RestTemplate
in future anyhow?The text was updated successfully, but these errors were encountered: