Polish documentation

This commit is contained in:
Phillip Webb 2014-12-17 11:33:09 -08:00
parent 80d55c4720
commit f35135e43d
1 changed files with 10 additions and 9 deletions

View File

@ -571,19 +571,18 @@ TIP: Using `@ConfigurationProperties` also allows you to generate meta-data file
be used by IDEs. See the <<configuration-metadata>> appendix for details. be used by IDEs. See the <<configuration-metadata>> appendix for details.
[[boot-features-external-config-3rd-party-configuration]] [[boot-features-external-config-3rd-party-configuration]]
==== Third-party configuration ==== Third-party configuration
As well as using `@ConfigurationProperties` to annotate a class, you can also use it
on `@Bean` methods. This can be particularly useful when you want to bind properties to
third-party components that are outside of your control.
You can also use that feature for third-party components: in that case, you can't obviously To configure a bean from the `Environment` properties, add `@ConfigurationProperties` to
add a `@ConfigurationProperties` to it if you don't have access to the source code or if that its bean registration:
component does not know about Spring Boot.
To configure a bean from the `Environment` properties, add `@ConfigurationProperties` to its
bean registration:
[source,java,indent=0] [source,java,indent=0]
---- ----
@ConfigurationProperties(prefix = "foo") @ConfigurationProperties(prefix = "foo")
@Bean @Bean
public FooComponent fooComponent() { public FooComponent fooComponent() {
@ -591,8 +590,10 @@ bean registration:
} }
---- ----
Any property defined with the `foo` prefix will be mapped onto that `FooComponent` bean in a Any property defined with the `foo` prefix will be mapped onto that `FooComponent` bean
similar manner as the `ConnectionSettings` example above. in a similar manner as the `ConnectionSettings` example above.
[[boot-features-external-config-relaxed-binding]] [[boot-features-external-config-relaxed-binding]]
==== Relaxed binding ==== Relaxed binding