Merge branch '2.6.x' into 2.7.x

Closes gh-29402
This commit is contained in:
Andy Wilkinson 2022-01-14 15:55:54 +00:00
commit b67cc62c37
1 changed files with 6 additions and 4 deletions

View File

@ -38,9 +38,10 @@ The following example shows a customizer that configures the use of a proxy for
include::{docs-java}/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.java[] include::{docs-java}/io/restclient/resttemplate/customization/MyRestTemplateCustomizer.java[]
---- ----
Finally, you can also create your own `RestTemplateBuilder` bean. Finally, you can define your own `RestTemplateBuilder` bean.
To prevent switching off the auto-configuration of a `RestTemplateBuilder` and prevent any `RestTemplateCustomizer` beans from being used, make sure to configure your custom instance with a `RestTemplateBuilderConfigurer`. Doing so will replace the auto-configured builder.
The following example exposes a `RestTemplateBuilder` with what Spring Boot would auto-configure, except that custom connect and read timeouts are also specified: If you want any `RestTemplateCustomizer` beans to be applied to your custom builder, as the auto-configuration would have done, configure it using a `RestTemplateBuilderConfigurer`.
The following example exposes a `RestTemplateBuilder` that matches what Spring Boot's auto-configuration would have done, except that custom connect and read timeouts are also specified:
[source,java,indent=0,subs="verbatim"] [source,java,indent=0,subs="verbatim"]
---- ----
@ -48,7 +49,8 @@ include::{docs-java}/io/restclient/resttemplate/customization/MyRestTemplateBuil
---- ----
The most extreme (and rarely used) option is to create your own `RestTemplateBuilder` bean without using a configurer. The most extreme (and rarely used) option is to create your own `RestTemplateBuilder` bean without using a configurer.
Doing so switches off the auto-configuration of a `RestTemplateBuilder` and prevents any `RestTemplateCustomizer` beans from being used. In addition to replacing the auto-configured builder, this also prevents any `RestTemplateCustomizer` beans from being used.
[[io.rest-client.webclient]] [[io.rest-client.webclient]]