Spring Boot offers a number of starters that work with HTTP clients. This section answers questions related to using them.
As described in io.adoc, you can use a RestTemplateCustomizer
with RestTemplateBuilder
to build a customized RestTemplate
.
This is the recommended approach for creating a RestTemplate
configured to use a proxy.
The exact details of the proxy configuration depend on the underlying client request factory that is being used.
When Reactor Netty is on the classpath a Reactor Netty-based WebClient
is auto-configured.
To customize the client’s handling of network connections, provide a ClientHttpConnector
bean.
The following example configures a 60 second connect timeout and adds a ReadTimeoutHandler
:
link:{docs-java}/howto/httpclients/webclientreactornettycustomization/MyReactorNettyClientConfiguration.java[role=include]
Tip
|
Note the use of ReactorResourceFactory for the connection provider and event loop resources.
This ensures efficient sharing of resources for the server receiving requests and the client making requests.
|