Document how Map properties are bound from environment variables
Closes gh-40936
This commit is contained in:
@@ -943,6 +943,24 @@ For example, the configuration property `my.service[0].other` would use an envir
|
||||
Support for binding from environment variables is applied to the `systemEnvironment` property source and to any additional property source whose name ends with `-systemEnvironment`.
|
||||
|
||||
|
||||
|
||||
[[features.external-config.typesafe-configuration-properties.relaxed-binding.maps-from-environment-variables]]
|
||||
===== Binding Maps from environment variables
|
||||
|
||||
When Spring Boot binds an environment variable to a property class, it lowercases the environment variable name before binding.
|
||||
Most of the time this detail isn't important, except when binding to `Map` properties.
|
||||
|
||||
The keys in the `Map` are always in lowercase, as seen in the following example:
|
||||
|
||||
include::code:MyMapsProperties[]
|
||||
|
||||
When setting `MY_PROPS_VALUES_KEY=value`, the `values` `Map` contains a `{"key"="value"}` entry.
|
||||
|
||||
Only the environment variable *name* is lower-cased, not the value.
|
||||
When setting `MY_PROPS_VALUES_KEY=VALUE`, the `values` `Map` contains a `{"key"="VALUE"}` entry.
|
||||
|
||||
|
||||
|
||||
[[features.external-config.typesafe-configuration-properties.relaxed-binding.caching]]
|
||||
===== Caching
|
||||
Relaxed binding uses a cache to improve performance. By default, this caching is only applied to immutable property sources.
|
||||
|
||||
@@ -218,7 +218,7 @@ It is also possible to set logging levels using environment variables.
|
||||
For example, `LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WEB=DEBUG` will set `org.springframework.web` to `DEBUG`.
|
||||
|
||||
NOTE: The above approach will only work for package level logging.
|
||||
Since relaxed binding always converts environment variables to lowercase, it is not possible to configure logging for an individual class in this way.
|
||||
Since relaxed binding <<features#features.external-config.typesafe-configuration-properties.relaxed-binding.maps-from-environment-variables, always converts environment variables to lowercase>>, it is not possible to configure logging for an individual class in this way.
|
||||
If you need to configure logging for a class, you can use <<features#features.external-config.application-json, the `SPRING_APPLICATION_JSON`>> variable.
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ When used to secure a client-side connection, a `truststore` is typically config
|
||||
|
||||
See {spring-boot-autoconfigure-module-code}/ssl/JksSslBundleProperties.java[JksSslBundleProperties] for the full set of supported properties.
|
||||
|
||||
NOTE: If you're using environment variables to configure the bundle, the name of the bundle is <<features#features.external-config.typesafe-configuration-properties.relaxed-binding.maps-from-environment-variables, always converted to lowercase>>.
|
||||
|
||||
|
||||
|
||||
[[features.ssl.pem]]
|
||||
@@ -106,6 +108,8 @@ The following example shows how a truststore certificate can be defined:
|
||||
|
||||
See {spring-boot-autoconfigure-module-code}/ssl/PemSslBundleProperties.java[PemSslBundleProperties] for the full set of supported properties.
|
||||
|
||||
NOTE: If you're using environment variables to configure the bundle, the name of the bundle is <<features#features.external-config.typesafe-configuration-properties.relaxed-binding.maps-from-environment-variables, always converted to lowercase>>.
|
||||
|
||||
|
||||
|
||||
[[features.ssl.applying]]
|
||||
|
||||
Reference in New Issue
Block a user