You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
[[webmvc-client]] |
|
= REST Clients |
|
|
|
This section describes options for client-side access to REST endpoints. |
|
|
|
|
|
|
|
|
|
[[webmvc-resttemplate]] |
|
== `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 `RestTemplate` is in maintenance mode, with only requests for minor |
|
changes and bugs to be accepted. Please, consider using the |
|
xref:web/webflux-webclient.adoc[WebClient] which offers a more modern API and |
|
supports sync, async, and streaming scenarios. |
|
|
|
See xref:integration/rest-clients.adoc[REST Endpoints] for details. |
|
|
|
|
|
|
|
|
|
[[webmvc-webclient]] |
|
== `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 xref:web/webflux-webclient.adoc[WebClient] for more details. |
|
|
|
|
|
|
|
|
|
[[webmvc-http-interface]] |
|
== HTTP Interface |
|
|
|
The Spring Frameworks lets you define an HTTP service as a Java interface with HTTP |
|
exchange methods. You can then generate a proxy that implements this interface and |
|
performs the exchanges. This helps to simplify HTTP remote access and provides additional |
|
flexibility for to choose an API style such as synchronous or reactive. |
|
|
|
See xref:integration/rest-clients.adoc#rest-http-interface[REST Endpoints] for details.
|
|
|