From d4435e015ca0e5c3292f2f2483a5d4bdb4a9e8b1 Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Tue, 30 Apr 2019 16:07:33 -0700 Subject: [PATCH] Polish "Document use of @Profile with @ConfigurationProperties scanning" Closes gh-16622 --- .../src/main/asciidoc/spring-boot-features.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index f2894f72e12..778014b2026 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -1640,6 +1640,11 @@ as shown in the following example: } ---- +NOTE: If `@ConfigurationProperties` beans are registered via `@EnableConfigurationProperties` +instead of automatic scanning, the `@Profile` annotation needs to be specified on the `@Configuration` +class that has the `@EnableConfigurationProperties` annotation. In the case where `@ConfigurationProperties` +are scanned, `@Profile` can be specified on the `@ConfigurationProperties` class itself. + You can use a `spring.profiles.active` `Environment` property to specify which profiles are active. You can specify the property in any of the ways described earlier in this chapter. For example, you could include it in your `application.properties`, as shown in