As far as I understood the RestTemplate is basically sundowning/frozen and the WebClient will be the http client to go in the future for WebMVC and WebFlux applications. So we can expect that sooner or later all/most webMVC applications will use webclient. If in light of project loom RestClient will be "reinstated", then this will be less important, of course.

To use Webclient right now you have to include Webflux as dependency, so in a webmc application you will end up bringing in the full webmvc and webflux webstack as dependency, although you just want to use webclient.

My suggestion is that Webflux is split up, so you have a smaller dependency to be included in webMVC applications without bringing in the rest of webflux that you don't need and that may lead to problems.

There are at least a couple of advantages for doing that.

For example: - with Conditional definitions (like ConditionalOnClass) that are activated by accident, because something was just meant for WebFlux applications. - it's much more clear what you are including in your application - you include less dependencies which may cause security issues - ...

Comment From: sbrannen

Hi @pcornelissen,

Congratulations on creating your first issue for the Spring Framework! 👍

Unfortunately, this is a:

  • duplicate of #21301

In the future, please search for existing issues before creating a new one.

Thanks


If in light of project loom RestClient will be "reinstated", then this will be less important, of course.

Regarding that, RestClient is new in Spring Framework 6.1 (which was just released) and is here to stay.

Comment From: pcornelissen

Ah sorry, did search, but didn't see this issue

Comment From: pcornelissen

(And it is closed and it's based on almost 6 year old assumptions/arguments, so maybe this issue might lead to new considerations)

Comment From: sbrannen

Hi @pcornelissen,

It's true that #21301 was closed more than 5 years ago; however, the arguments made then are still applicable today.