Add global optional config data opt-out

Support a `spring.config.all-locations-optional` property which can be
set to `true` if all config data locations should be considered
optional.

Closes gh-23097
This commit is contained in:
Phillip Webb
2020-08-26 20:11:40 -07:00
parent c1be5cb5e0
commit aa0f204732
10 changed files with 75 additions and 40 deletions

View File

@@ -623,6 +623,9 @@ You can use this prefix with the `spring.config.location` and `spring.config.add
For example, a `spring.config.import` value of `optional:file:./myconfig.properties` allows your application to start, even if the `myconfig.properties` file is missing.
If you want all locations to be considered optional, you can use the `spring.config.all-locations-optional` property.
Set the value to `true` using `SpringApplication.setDefaultProperties(...)` or with a system/environment variable.
[[boot-features-external-config-files-wildcards]]