Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 1.45 KB

webmvc-client.adoc

File metadata and controls

44 lines (27 loc) · 1.45 KB

REST Clients

This section describes options for client-side access to REST endpoints.

RestTemplate

RestTemplate is a synchronous client to perform HTTP requests. It is the original Spring REST client and exposes a simple, template-method API over underlying HTTP client libraries.

Note
As of 5.0, the non-blocking, reactive WebClient offers a modern alternative to the RestTemplate, with efficient support for both synchronous and asynchronous, as well as streaming scenarios. The RestTemplate will be deprecated in a future version and will not have major new features added going forward.

See REST Endpoints for details.

WebClient

WebClient is a non-blocking, reactive client to perform HTTP requests. It was introduced in 5.0 and offers a modern alternative to the RestTemplate, with efficient support for both synchronous and asynchronous, as well as streaming scenarios.

In contrast to RestTemplate, WebClient supports the following:

  • Non-blocking I/O.

  • Reactive Streams back pressure.

  • High concurrency with fewer hardware resources.

  • Functional-style, fluent API that takes advantage of Java 8 lambdas.

  • Synchronous and asynchronous interactions.

  • Streaming up to or streaming down from a server.

See WebClient for more details.