Add prefix support for property source

We configure the `SystemEnvironmentPropertySource` as a `Prefixed` property
source. When adapting this to a `ConfigurationPropertySource, a
`PrefixedConfigurationPropertySource` will be created for it.
A `PrefixedConfigurationPropertySource` will resolve property
such as `foo.bar` to `my.foo.bar` for a prefix of `my`.

Closes gh-3450
This commit is contained in:
Madhura Bhave
2021-02-25 09:15:08 -08:00
parent 888ca442fa
commit a8592f36d4
14 changed files with 416 additions and 17 deletions

View File

@@ -996,6 +996,14 @@ The `+random.int*+` syntax is `OPEN value (,max) CLOSE` where the `OPEN,CLOSE` a
If `max` is provided, then `value` is the minimum value and `max` is the maximum value (exclusive).
[[boot-features-external-config-system-environment]]
=== Configuring System Environment Properties
Spring Boot supports setting a prefix for environment properties.
This is useful if the system environment is shared by multiple Spring Boot applications with different configuration requirements.
The prefix for system environment properties can be set directly on `SpringApplication`.
For example, if you set the prefix to `input`, a property such as `foo.bar` will also be resolved as `input.foo.bar` in the system environment.
[[boot-features-external-config-typesafe-configuration-properties]]
=== Type-safe Configuration Properties