Non-blocking cross-service communication with WebClient

In the previous sections, we looked at an overview of the basic design of and changes in the new Spring WebFlux module and learned about new functional approaches with RoutesFunction. However, Spring WebFlux also contains other new possibilities. One of the most important introductions is the new non-blocking HTTP client, which is called WebClient.

Essentially, WebClient is the reactive replacement for the old RestTemplate.  However, in WebClient, we have a functional API that fits better with the reactive approach and offers built-in mapping to Project Reactor types such as Flux or Mono. In order to learn more about WebClient, let's have a look at the following example:

WebClient. ...

Get Hands-On Reactive Programming in Spring 5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.