Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ffbbd2a5
Commit
ffbbd2a5
authored
Nov 01, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x' into 1.5.x
parents
90cc322c
be78dc4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+15
-5
No files found.
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
ffbbd2a5
...
...
@@ -4490,11 +4490,17 @@ configure a `RestTemplate`. For example, to add BASIC auth support you can use
[[boot-features-restclient-customization]]
=== RestTemplate customization
When a `RestTemplateBuilder` builds a `RestTemplate` it can be further customized using
a `RestTemplateCustomizer`. Any `RestTemplateCustomizer` beans will be automatically
added to the auto-configured `RestTemplateBuilder`. Furthermore, a new
`RestTemplateBuilder` with additional customizers can be created by calling
`additionalCustomizers(RestTemplateCustomizer...)`.
There are three main approaches to `RestTemplate` customization, depending on how broadly
to want the customizations to apply.
To make the scope of any customizations as narrow as possible, inject the auto-configured
`RestTemplateBuilder` and then calls its methods as required. Each method call returns a
new `RestTemplateBuilder` instance so the customizations will only affect this use of
the builder.
To make a application-wide, additive customization a `RestTemplateCustomizer` bean can be
used. All such beans are automatically registered with the auto-configured
`RestTemplateBuilder` and will be applied to any templates that are built with it.
Here's an example of a customizer that configures the use of a proxy for all hosts except
`192.168.0.5`:
...
...
@@ -4504,6 +4510,10 @@ Here's an example of a customizer that configures the use of a proxy for all hos
include::{code-examples}/web/client/RestTemplateProxyCustomizationExample.java[tag=customizer]
----
Lastly, the most extreme (and rarely used) option is to create your own
`RestTemplateBuilder` bean. This will switch off the auto-configuration of a
`RestTemplateBuilder` and will prevent any `RestTemplateCustomizer` beans from being used.
[[boot-features-email]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment