spring-guides / gs-consuming-rest

Consuming a RESTful Web Service :: Learn how to retrieve web page data with Spring's RestTemplate.
https://spring.io/guides/gs/consuming-rest/
Apache License 2.0
195 stars 287 forks source link

RestTemplate is being deprecated. #28

Closed dailytabs closed 1 year ago

dailytabs commented 6 years ago

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

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.

Anyone care to rewrite this guide for WebClient?

UgmaDevelopment commented 3 years ago

I came here to bring up this same thing, but as I'm just learning, I'm unsure how quickly it needs to be changed.

Regardless, thanks @dailytabs and @gregturn, @Buzzardo and others for your hard work!

bosatsu commented 3 years ago

https://gturnquist-quoters.cfapps.io/api/random returns 404, even in a browser.

ssjlee93 commented 2 years ago

https://gturnquist-quoters.cfapps.io/api/random returns 404, even in a browser.

Check out #47 . @ayan-b posted a temporary workaround.

Kumar2106 commented 2 years ago

I have heard in a youtube video, that yes it is going to be deprecated.

dedeibel commented 2 years ago

I was worried too but apparently the wording changed at some point. Does it mean that code that uses it is fine but it is not recommended for new code? Or is it actually just a matter of your requirement and taste?

NOTE: As of 5.0 this class is in maintenance mode, with only minor requests for changes and bugs to be accepted going forward. Please, consider using the org.springframework.web.reactive.client.WebClient which has a more modern API and supports sync, async, and streaming scenarios.

rearl commented 1 year ago

I noted the same as @dedeibel. So I'm curious to know what happens with RestTemplate in the future. To assess whether a migration to WebClient is (already) necessary or not. Can anyone give us more information on this?

Buzzardo commented 1 year ago

As folks have noticed, the Spring Team plans to continue to make RestTemplate available as is (but only as-is - only something like a CVE would make us change it). If you need it, use it, but we do recommend WebClient as the modern replacement.