org.springframework.context.support

## 类 PropertySourcesPlaceholderConfigurer

- java.lang.Object
- - org.springframework.core.io.support.PropertiesLoaderSupport
  - - org.springframework.beans.factory.config.PropertyResourceConfigurer
    - - org.springframework.beans.factory.config.PlaceholderConfigurerSupport
      - - org.springframework.context.support.PropertySourcesPlaceholderConfigurer

- 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, EnvironmentAware, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

      public class PropertySourcesPlaceholderConfigurer
      extends org.springframework.beans.factory.config.PlaceholderConfigurerSupport
      implements EnvironmentAware

  Specialization of `PlaceholderConfigurerSupport` that resolves ${...} placeholders within bean definition property values and `@Value` annotations against the current Spring `Environment` and its set of `PropertySources`.

  This class is designed as a general replacement for `PropertyPlaceholderConfigurer` introduced in Spring 3.1. It is used by default to support the `property-placeholder` element in working against the spring-context-3.1 or higher XSD, whereas spring-context versions <= 3.0 default to `PropertyPlaceholderConfigurer` to ensure backward compatibility. See the spring-context XSD documentation for complete details.

  Any local properties (e.g. those added via `PropertiesLoaderSupport.setProperties(java.util.Properties)`, `PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource...)` et al.) are added as a `PropertySource`. Search precedence of local properties is based on the value of the `localOverride` property, which is by default `false` meaning that local properties are to be searched last, after all environment property sources.

  See `ConfigurableEnvironment` and related javadocs for details on manipulating environment property sources.

  从以下版本开始:
    3.1
  作者:
    Chris Beams, Juergen Hoeller
  另请参阅:
    `ConfigurableEnvironment`, `PlaceholderConfigurerSupport`, `PropertyPlaceholderConfigurer`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME` "environmentProperties" is the name given to the `PropertySource` that wraps the environment supplied to this configurer.
    `static String` | `LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME` "localProperties" is the name given to the `PropertySource` for the set of merged properties supplied to this configurer.

    - ### 从类继承的字段 org.springframework.beans.factory.config.PlaceholderConfigurerSupport

      `DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, trimValues, valueSeparator`

    - ### 从类继承的字段 org.springframework.core.io.support.PropertiesLoaderSupport

      `localOverride, localProperties, logger`

    - ### 从接口继承的字段 org.springframework.core.Ordered

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

    构造器
    构造器和说明
    `PropertySourcesPlaceholderConfigurer()`

  - ### 方法概要

    所有方法 实例方法 具体方法 已过时的方法
    限定符和类型 | 方法和说明
    --- | ---
    `org.springframework.core.env.PropertySources` | `getAppliedPropertySources()` Return the property sources that were actually applied during `post-processing`.
    `void` | `postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Processing occurs by replacing ${...} placeholders in bean definitions by resolving each against this configurer's set of `PropertySources`, which includes: all environment property sources, if an `Environment` is present merged local properties, if any have been specified any property sources set by calling `setPropertySources(org.springframework.core.env.PropertySources)` If `setPropertySources(org.springframework.core.env.PropertySources)` is called, environment and local properties will be ignored.
    `protected void` | `processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactoryToProcess, org.springframework.core.env.ConfigurablePropertyResolver propertyResolver)` Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties.
    `protected void` | `processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, Properties props)` 已过时。 in favor of `processProperties(ConfigurableListableBeanFactory, ConfigurablePropertyResolver)`
    `void` | `setEnvironment(org.springframework.core.env.Environment environment)` `PropertySources` from the given `Environment` will be searched when replacing ${...} placeholders.
    `void` | `setPropertySources(org.springframework.core.env.PropertySources propertySources)` Customize the set of `PropertySources` to be used by this configurer.

    - ### 从类继承的方法 org.springframework.beans.factory.config.PlaceholderConfigurerSupport

      `doProcessProperties, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setTrimValues, setValueSeparator`

    - ### 从类继承的方法 org.springframework.beans.factory.config.PropertyResourceConfigurer

      `convertProperties, convertProperty, convertPropertyValue, getOrder, setOrder`

    - ### 从类继承的方法 org.springframework.core.io.support.PropertiesLoaderSupport

      `loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME

          public static final String LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME

      "localProperties" is the name given to the `PropertySource` for the set of merged properties supplied to this configurer.
      另请参阅:
        常量字段值

    - #### ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME

          public static final String ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME

      "environmentProperties" is the name given to the `PropertySource` that wraps the environment supplied to this configurer.
      另请参阅:
        常量字段值

  - ### 构造器详细资料

    - #### PropertySourcesPlaceholderConfigurer

          public PropertySourcesPlaceholderConfigurer()

  - ### 方法详细资料

    - #### setPropertySources

          public void setPropertySources(org.springframework.core.env.PropertySources propertySources)

      Customize the set of `PropertySources` to be used by this configurer.

      Setting this property indicates that environment property sources and local properties should be ignored.

      另请参阅:
        `postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)`

    - #### setEnvironment

          public void setEnvironment(org.springframework.core.env.Environment environment)

      `PropertySources` from the given `Environment` will be searched when replacing ${...} placeholders.
      指定者:
        `setEnvironment` 在接口中 `EnvironmentAware`
      另请参阅:
        `setPropertySources(org.springframework.core.env.PropertySources)`, `postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)`

    - #### postProcessBeanFactory

          public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
                                      throws org.springframework.beans.BeansException

      Processing occurs by replacing ${...} placeholders in bean definitions by resolving each against this configurer's set of `PropertySources`, which includes:
      - all environment property sources, if an `Environment` is present
      - merged local properties, if any have been specified
      - any property sources set by calling `setPropertySources(org.springframework.core.env.PropertySources)`

      If `setPropertySources(org.springframework.core.env.PropertySources)` is called, environment and local properties will be ignored. This method is designed to give the user fine-grained control over property sources, and once set, the configurer makes no assumptions about adding additional sources.

      指定者:
        `postProcessBeanFactory` 在接口中 `org.springframework.beans.factory.config.BeanFactoryPostProcessor`
      覆盖:
        `postProcessBeanFactory` 在类中 `org.springframework.beans.factory.config.PropertyResourceConfigurer`
      抛出:
        `org.springframework.beans.BeansException`

    - #### processProperties

          protected void processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactoryToProcess,
                                           org.springframework.core.env.ConfigurablePropertyResolver propertyResolver)
                                    throws org.springframework.beans.BeansException

      Visit each bean definition in the given bean factory and attempt to replace ${...} property placeholders with values from the given properties.
      抛出:
        `org.springframework.beans.BeansException`

    - #### processProperties

          @Deprecated
          protected void processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory,
                                                        Properties props)

      已过时。 in favor of `processProperties(ConfigurableListableBeanFactory, ConfigurablePropertyResolver)`
      Implemented for compatibility with `PlaceholderConfigurerSupport`.
      指定者:
        `processProperties` 在类中 `org.springframework.beans.factory.config.PropertyResourceConfigurer`
      抛出:
        `UnsupportedOperationException` - in this implementation

    - #### getAppliedPropertySources

          public org.springframework.core.env.PropertySources getAppliedPropertySources()
                                                                                 throws IllegalStateException

      Return the property sources that were actually applied during `post-processing`.
      返回:
        the property sources that were applied
      抛出:
        `IllegalStateException` - if the property sources have not yet been applied
      从以下版本开始:
        4.0