类 ConfigurationPropertySources

java.lang.Object
cn.taketoday.context.properties.source.ConfigurationPropertySources

public final class ConfigurationPropertySources extends Object
Provides access to ConfigurationPropertySources.
从以下版本开始:
4.0
作者:
Phillip Webb, Harry Yang
  • 方法详细资料

    • createPropertyResolver

      public static cn.taketoday.core.env.ConfigurablePropertyResolver createPropertyResolver(cn.taketoday.core.env.PropertySources propertySources)
      Create a new PropertyResolver that resolves property values against an underlying set of PropertySources. Provides an ConfigurationPropertySource aware and optimized alternative to PropertySourcesPropertyResolver.
      参数:
      propertySources - the set of PropertySource objects to use
      返回:
      a ConfigurablePropertyResolver implementation
    • isAttachedConfigurationPropertySource

      public static boolean isAttachedConfigurationPropertySource(cn.taketoday.core.env.PropertySource<?> propertySource)
      Determines if the specific PropertySource is the ConfigurationPropertySource that was attached to the Environment.
      参数:
      propertySource - the property source to test
      返回:
      true if this is the attached ConfigurationPropertySource
    • attach

      public static void attach(cn.taketoday.core.env.Environment environment)
      Attach a 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

      public static Iterable<ConfigurationPropertySource> get(cn.taketoday.core.env.Environment environment)
      Return a set of ConfigurationPropertySource instances that have previously been attached to the Environment.
      参数:
      environment - the source environment (must be an instance of ConfigurableEnvironment)
      返回:
      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)
      Return Iterable containing a single new ConfigurationPropertySource adapted from the given Framework PropertySource.
      参数:
      source - the Framework property source to adapt
      返回:
      an Iterable containing a single newly adapted DefaultConfigurationPropertySource
    • from

      public static Iterable<ConfigurationPropertySource> from(Iterable<cn.taketoday.core.env.PropertySource<?>> sources)
      Return Iterable containing new ConfigurationPropertySource instances adapted from the given Framework PropertySources.

      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 a PropertySources

      参数:
      sources - the Framework property sources to adapt
      返回:
      an Iterable containing newly adapted DefaultConfigurationPropertySource instances