From 51ede0cac69eff0ec333e2ec333368d84536094e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 15 Jul 2016 13:16:33 -0700 Subject: [PATCH] Document ConfigFile...Initializer limitations Update the reference documentation with a note about the limitations of ConfigFileApplicationContextInitializer. Fixes gh-6120 --- .../src/main/asciidoc/spring-boot-features.adoc | 6 ++++++ 1 file changed, 6 insertions(+) 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 89a62459b7..edaef7f822 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -5370,6 +5370,12 @@ this when you don't need the full features provided by `@SpringBootTest`. initializers = ConfigFileApplicationContextInitializer.class) ---- +NOTE: Using `ConfigFileApplicationContextInitializer` alone won't provide support for +`@Value("${...}")` injection. Its only job is to ensure that `application.properties` files +are loaded into Spring's `Environment`. For `@Value` support you need to either +additionally configure a `PropertySourcesPlaceholderConfigurer` or use `@SpringBootTest` +where one will be auto-configured for you. + [[boot-features-environment-test-utilities]]