public final class ConfigurationPropertySources extends Object
ConfigurationPropertySources
.Modifier and Type | Method and Description |
---|---|
static void |
attach(Environment environment)
Attach a
ConfigurationPropertySource support to the specified
Environment . |
static Iterable<ConfigurationPropertySource> |
from(Iterable<PropertySource<?>> sources)
Return
Iterable containing new ConfigurationPropertySource
instances adapted from the given Spring PropertySources . |
static Iterable<ConfigurationPropertySource> |
from(MutablePropertySources sources)
Return
Iterable containing new ConfigurationPropertySource
instances adapted from the given Spring MutablePropertySources . |
static Iterable<ConfigurationPropertySource> |
from(PropertySource<?> source)
Return
Iterable containing a single new ConfigurationPropertySource
adapted from the given Spring PropertySource . |
static Iterable<ConfigurationPropertySource> |
get(Environment environment)
Return a set of
ConfigurationPropertySource instances that have previously
been attached to the Environment . |
public static void attach(Environment environment)
ConfigurationPropertySource
support to the specified
Environment
. Adapts each PropertySource
managed by the environment
to a ConfigurationPropertySource
and allows classic
PropertySourcesPropertyResolver
calls to resolve using
configuration property names
.
The attached resolver will dynamically track any additions or removals from the
underlying Environment
property sources.
environment
- the source environment (must be an instance of
ConfigurableEnvironment
)get(Environment)
public static Iterable<ConfigurationPropertySource> get(Environment environment)
ConfigurationPropertySource
instances that have previously
been attached
to the Environment
.environment
- the source environment (must be an instance of
ConfigurableEnvironment
)IllegalStateException
- if not configuration property sources have been
attachedpublic static Iterable<ConfigurationPropertySource> from(PropertySource<?> source)
Iterable
containing a single new ConfigurationPropertySource
adapted from the given Spring PropertySource
.source
- the Spring property source to adaptIterable
containing a single newly adapted
SpringConfigurationPropertySource
public static Iterable<ConfigurationPropertySource> from(MutablePropertySources sources)
Iterable
containing new ConfigurationPropertySource
instances adapted from the given Spring MutablePropertySources
.
This method will flatten any nested property sources and will filter all
stub property sources
. Updates to the underlying source
will be automatically tracked.
sources
- the Spring property sources to adaptIterable
containing a single newly adapted
SpringConfigurationPropertySource
instancespublic static Iterable<ConfigurationPropertySource> from(Iterable<PropertySource<?>> sources)
Iterable
containing new ConfigurationPropertySource
instances adapted from the given Spring PropertySources
.
This method will flatten any nested property sources and will filter all
stub property sources
.
sources
- the Spring property sources to adaptIterable
containing a single newly adapted
SpringConfigurationPropertySource
instancesCopyright © 2017 Pivotal Software, Inc.. All rights reserved.