Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can spring webclient be used with RESTful API which is not reactive based?

Is there any issues with using WebClient for fetching responses from multiple REST APIs which are not reactive based.

like image 904
programmer Avatar asked Oct 12 '25 08:10

programmer


1 Answers

Yes, you definitely can, and in fact, the use of WebClient is encouraged by Spring officially. Also, the RestTemplate which is generally the preferred way of communication for REST-based services has already been deprecated.

Also, there are no issues when using WebClient in a non-reactive context

enter image description here

https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/web.html#webmvc-client

However, you'll explicitly have to call subscribe or block when using WebClient in a non-reactive context.

like image 95
Isank Avatar answered Oct 16 '25 00:10

Isank



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!