Allow RestTemplateBuilder to be further customized
Closes gh-23389
This commit is contained in:
@@ -5975,7 +5975,16 @@ The following example shows a customizer that configures the use of a proxy for
|
||||
include::{code-examples}/web/client/RestTemplateProxyCustomizationExample.java[tag=customizer]
|
||||
----
|
||||
|
||||
Finally, the most extreme (and rarely used) option is to create your own `RestTemplateBuilder` bean.
|
||||
Finally, you can also create 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`.
|
||||
The following example exposes a `RestTemplateBuilder` with what Spring Boot would auto-configure, except that custom connect and read timeouts are also specified:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::{code-examples}/web/client/RestTemplateBuilderCustomizationExample.java[tag=customizer]
|
||||
----
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user