Finds a discriminated property in the environment for the given basic key, if available. For
example, given a basic key of
my.company.property
, the system will check several keys in
the following order:
my.company.application.{applicationId}.property
my.company.tenant.{tenantId}.property
my.company.property
The first value found will be used. The
applicationId
and
tenantId
values are
informed by
DiscriminatedPropertyContext
, which is generally set via
DiscriminatedPropertyFilter
. Any information available in the context will be harvested
here in order to create the property key combinations. Either tenantId, applicationId (or both)
are supported in the context and best attempt will be made to fashion keys based on the context
information available. If no context is provided, then the basic key is used. If no properties
are available in the environment, then the default value specified in the instance variable in
the
ConfigurationProperties
annotated bean will be used.
A cache of keys to values is also maintained for performance. This cache is groomed when the
component receives a
EnvironmentChangeEvent
, which generally results from an environment
refresh from a Spring Cloud Config server.