类 ConfigurationPropertySources
java.lang.Object
cn.taketoday.context.properties.source.ConfigurationPropertySources
Provides access to
ConfigurationPropertySources.- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb, Harry Yang
-
方法概要
修饰符和类型方法说明static voidattach(cn.taketoday.core.env.Environment environment) Attach aConfigurationPropertySourcesupport to the specifiedEnvironment.static cn.taketoday.core.env.ConfigurablePropertyResolvercreatePropertyResolver(cn.taketoday.core.env.PropertySources propertySources) Create a newPropertyResolverthat resolves property values against an underlying set ofPropertySources.static Iterable<ConfigurationPropertySource>from(cn.taketoday.core.env.PropertySource<?> source) ReturnIterablecontaining a single newConfigurationPropertySourceadapted from the given FrameworkPropertySource.static Iterable<ConfigurationPropertySource>ReturnIterablecontaining newConfigurationPropertySourceinstances adapted from the given FrameworkPropertySources.static Iterable<ConfigurationPropertySource>get(cn.taketoday.core.env.Environment environment) Return a set ofConfigurationPropertySourceinstances that have previously beenattachedto theEnvironment.static booleanisAttachedConfigurationPropertySource(cn.taketoday.core.env.PropertySource<?> propertySource) Determines if the specificPropertySourceis theConfigurationPropertySourcethat wasattachedto theEnvironment.
-
方法详细资料
-
createPropertyResolver
public static cn.taketoday.core.env.ConfigurablePropertyResolver createPropertyResolver(cn.taketoday.core.env.PropertySources propertySources) Create a newPropertyResolverthat resolves property values against an underlying set ofPropertySources. Provides anConfigurationPropertySourceaware and optimized alternative toPropertySourcesPropertyResolver.- 参数:
propertySources- the set ofPropertySourceobjects to use- 返回:
- a
ConfigurablePropertyResolverimplementation
-
isAttachedConfigurationPropertySource
public static boolean isAttachedConfigurationPropertySource(cn.taketoday.core.env.PropertySource<?> propertySource) Determines if the specificPropertySourceis theConfigurationPropertySourcethat wasattachedto theEnvironment.- 参数:
propertySource- the property source to test- 返回:
trueif this is the attachedConfigurationPropertySource
-
attach
public static void attach(cn.taketoday.core.env.Environment environment) Attach aConfigurationPropertySourcesupport to the specifiedEnvironment. Adapts eachPropertySourcemanaged by the environment to aConfigurationPropertySourceand allows classicPropertySourcesPropertyResolvercalls to resolve usingconfiguration property names.The attached resolver will dynamically track any additions or removals from the underlying
Environmentproperty sources.- 参数:
environment- the source environment (must be an instance ofConfigurableEnvironment)- 另请参阅:
-
get
public static Iterable<ConfigurationPropertySource> get(cn.taketoday.core.env.Environment environment) Return a set ofConfigurationPropertySourceinstances that have previously beenattachedto theEnvironment.- 参数:
environment- the source environment (must be an instance ofConfigurableEnvironment)- 返回:
- an iterable set of configuration property sources
- 抛出:
IllegalStateException- if not configuration property sources have been attached
-
from
public static Iterable<ConfigurationPropertySource> from(cn.taketoday.core.env.PropertySource<?> source) ReturnIterablecontaining a single newConfigurationPropertySourceadapted from the given FrameworkPropertySource.- 参数:
source- the Framework property source to adapt- 返回:
- an
Iterablecontaining a single newly adaptedDefaultConfigurationPropertySource
-
from
public static Iterable<ConfigurationPropertySource> from(Iterable<cn.taketoday.core.env.PropertySource<?>> sources) ReturnIterablecontaining newConfigurationPropertySourceinstances adapted from the given FrameworkPropertySources.This method will flatten any nested property sources and will filter all
stub property sources. Updates to the underlying source, identified by changes in the sources returned by its iterator, will be automatically tracked. The underlying source should be thread safe, for example aPropertySources- 参数:
sources- the Framework property sources to adapt- 返回:
- an
Iterablecontaining newly adaptedDefaultConfigurationPropertySourceinstances
-