From f35135e43d864f454efac607c7d69aff4b7e0df3 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 17 Dec 2014 11:33:09 -0800 Subject: [PATCH] Polish documentation --- .../main/asciidoc/spring-boot-features.adoc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 001c329e2e..028d0736cd 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -571,19 +571,18 @@ TIP: Using `@ConfigurationProperties` also allows you to generate meta-data file be used by IDEs. See the <> appendix for details. + [[boot-features-external-config-3rd-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 -add a `@ConfigurationProperties` to it if you don't have access to the source code or if that -component does not know about Spring Boot. - -To configure a bean from the `Environment` properties, add `@ConfigurationProperties` to its -bean registration: +To configure a bean from the `Environment` properties, add `@ConfigurationProperties` to +its bean registration: [source,java,indent=0] ---- - @ConfigurationProperties(prefix = "foo") @Bean 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 -similar manner as the `ConnectionSettings` example above. +Any property defined with the `foo` prefix will be mapped onto that `FooComponent` bean +in a similar manner as the `ConnectionSettings` example above. + + [[boot-features-external-config-relaxed-binding]] ==== Relaxed binding