Commit 51ede0ca authored by Phillip Webb's avatar Phillip Webb

Document ConfigFile...Initializer limitations

Update the reference documentation with a note about the limitations of
ConfigFileApplicationContextInitializer.

Fixes gh-6120
parent 7b641d5d
...@@ -5370,6 +5370,12 @@ this when you don't need the full features provided by `@SpringBootTest`. ...@@ -5370,6 +5370,12 @@ this when you don't need the full features provided by `@SpringBootTest`.
initializers = ConfigFileApplicationContextInitializer.class) 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]] [[boot-features-environment-test-utilities]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment