3 changed files with 39 additions and 10 deletions
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
[[webmvc-client]] |
||||
= REST Clients |
||||
|
||||
This section describes options for client-side access to REST endpoints. |
||||
|
||||
[[webmvc-resttemplate]] |
||||
== RestTemplate |
||||
|
||||
`RestTemplate` is the original Spring REST client that follows a similar approach to other |
||||
template classes in the Spring Framework (e.g. `JdbcTemplate`, `JmsTemplate`, etc.) by |
||||
providing a list of parameterizable methods to perform HTTP requests. |
||||
|
||||
`RestTemplate` has a synchronous API and relies on blocking I/O. This is okay for |
||||
client scenarios with low concurrency. In a server environment or when orchestrating a |
||||
sequence of remote calls, prefer using the `WebClient` which provides a more efficient |
||||
execution model including seamless support for streaming. |
||||
|
||||
See <<integration.adoc#rest-client-access,RestTemplate>> for more details on using the |
||||
`RestTemplate`. |
||||
|
||||
|
||||
[[webmvc-webclient]] |
||||
== WebClient |
||||
|
||||
`WebClient` is a reactive client that provides an alternative to the `RestTemplate`. It |
||||
exposes a functional, fluent API and relies on non-blocking I/O which allows it to support |
||||
high concurrency more efficiently (i.e. using a small number of threads) than the |
||||
`RestTemplate`. `WebClient` is a natural fit for streaming scenarios. |
||||
|
||||
See <<web-reactive.adoc#webflux-client,WebClient>> for more details on using the `WebClient`. |
Loading…
Reference in new issue