org.springframework.beans.factory.config

## 类 PlaceholderConfigurerSupport

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

- 所有已实现的接口:
    Aware, BeanFactoryAware, BeanNameAware, BeanFactoryPostProcessor, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered
  直接已知子类:
    PropertyPlaceholderConfigurer

      public abstract class PlaceholderConfigurerSupport
      extends PropertyResourceConfigurer
      implements BeanNameAware, BeanFactoryAware

  Abstract base class for property resource configurers that resolve placeholders in bean definition property values. Implementations pull values from a properties file or other property source into bean definitions.

  The default placeholder syntax follows the Ant / Log4J / JSP EL style:

      ${...}

  Example XML bean definition:

  Example properties file:

      driver=com.mysql.jdbc.Driver
       dbname=mysql:mydb

  Annotated bean definitions may take advantage of property replacement using the `@Value` annotation:

      @Value("${person.age}")

  Implementations check simple property values, lists, maps, props, and bean names in bean references. Furthermore, placeholder values can also cross-reference other placeholders, like:

      rootPath=myrootdir
       subPath=${rootPath}/subdir

  In contrast to `PropertyOverrideConfigurer`, subclasses of this type allow filling in of explicit placeholders in bean definitions.

  If a configurer cannot resolve a placeholder, a `BeanDefinitionStoreException` will be thrown. If you want to check against multiple properties files, specify multiple resources via the `locations` property. You can also define multiple configurers, each with its own placeholder syntax. Use `ignoreUnresolvablePlaceholders` to intentionally suppress throwing an exception if a placeholder cannot be resolved.

  Default property values can be defined globally for each configurer instance via the `properties` property, or on a property-by-property basis using the default value separator which is `":"` by default and customizable via `setValueSeparator(String)`.

  Example XML property with default value:

  从以下版本开始:
    3.1
  作者:
    Chris Beams, Juergen Hoeller
  另请参阅:
    `PropertyPlaceholderConfigurer`, `org.springframework.context.support.PropertySourcesPlaceholderConfigurer`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `DEFAULT_PLACEHOLDER_PREFIX` Default placeholder prefix: "${"
    `static String` | `DEFAULT_PLACEHOLDER_SUFFIX` Default placeholder suffix: "}"
    `static String` | `DEFAULT_VALUE_SEPARATOR` Default value separator: ":"
    `protected boolean` | `ignoreUnresolvablePlaceholders`
    `protected String` | `nullValue`
    `protected String` | `placeholderPrefix` Defaults to "${"
    `protected String` | `placeholderSuffix` Defaults to "}"
    `protected boolean` | `trimValues`
    `protected String` | `valueSeparator` Defaults to ":"

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

      `localOverride, localProperties, logger`

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

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `doProcessProperties(ConfigurableListableBeanFactory beanFactoryToProcess, org.springframework.util.StringValueResolver valueResolver)`
    `void` | `setBeanFactory(BeanFactory beanFactory)` Only necessary to check that we're not parsing our own bean definition, to avoid failing on unresolvable placeholders in properties file locations.
    `void` | `setBeanName(String beanName)` Only necessary to check that we're not parsing our own bean definition, to avoid failing on unresolvable placeholders in properties file locations.
    `void` | `setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders)` Set whether to ignore unresolvable placeholders.
    `void` | `setNullValue(String nullValue)` Set a value that should be treated as `null` when resolved as a placeholder value: e.g. "" (empty String) or "null".
    `void` | `setPlaceholderPrefix(String placeholderPrefix)` Set the prefix that a placeholder string starts with.
    `void` | `setPlaceholderSuffix(String placeholderSuffix)` Set the suffix that a placeholder string ends with.
    `void` | `setTrimValues(boolean trimValues)` Specify whether to trim resolved values before applying them, removing superfluous whitespace from the beginning and end.
    `void` | `setValueSeparator(String valueSeparator)` Specify the separating character between the placeholder variable and the associated default value, or `null` if no such special character should be processed as a value separator.

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

      `convertProperties, convertProperty, convertPropertyValue, getOrder, postProcessBeanFactory, processProperties, 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`

- - ### 字段详细资料

    - #### DEFAULT_PLACEHOLDER_PREFIX

          public static final String DEFAULT_PLACEHOLDER_PREFIX

      Default placeholder prefix: "${"
      另请参阅:
        常量字段值

    - #### DEFAULT_PLACEHOLDER_SUFFIX

          public static final String DEFAULT_PLACEHOLDER_SUFFIX

      Default placeholder suffix: "}"
      另请参阅:
        常量字段值

    - #### DEFAULT_VALUE_SEPARATOR

          public static final String DEFAULT_VALUE_SEPARATOR

      Default value separator: ":"
      另请参阅:
        常量字段值

    - #### placeholderPrefix

          protected String placeholderPrefix

      Defaults to "${"

    - #### placeholderSuffix

          protected String placeholderSuffix

      Defaults to "}"

    - #### valueSeparator

          @Nullable
          protected String valueSeparator

      Defaults to ":"

    - #### trimValues

          protected boolean trimValues

    - #### nullValue

          @Nullable
          protected String nullValue

    - #### ignoreUnresolvablePlaceholders

          protected boolean ignoreUnresolvablePlaceholders

  - ### 构造器详细资料

    - #### PlaceholderConfigurerSupport

          public PlaceholderConfigurerSupport()

  - ### 方法详细资料

    - #### setPlaceholderPrefix

          public void setPlaceholderPrefix(String placeholderPrefix)

      Set the prefix that a placeholder string starts with. The default is "${".

    - #### setPlaceholderSuffix

          public void setPlaceholderSuffix(String placeholderSuffix)

      Set the suffix that a placeholder string ends with. The default is "}".

    - #### setValueSeparator

          public void setValueSeparator(@Nullable
                                        String valueSeparator)

      Specify the separating character between the placeholder variable and the associated default value, or `null` if no such special character should be processed as a value separator. The default is ":".

    - #### setTrimValues

          public void setTrimValues(boolean trimValues)

      Specify whether to trim resolved values before applying them, removing superfluous whitespace from the beginning and end.

      Default is `false`.

      从以下版本开始:
        4.3

    - #### setNullValue

          public void setNullValue(String nullValue)

      Set a value that should be treated as `null` when resolved as a placeholder value: e.g. "" (empty String) or "null".

      Note that this will only apply to full property values, not to parts of concatenated values.

      By default, no such null value is defined. This means that there is no way to express `null` as a property value unless you explicitly map a corresponding value here.

    - #### setIgnoreUnresolvablePlaceholders

          public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders)

      Set whether to ignore unresolvable placeholders.

      Default is "false": An exception will be thrown if a placeholder fails to resolve. Switch this flag to "true" in order to preserve the placeholder String as-is in such a case, leaving it up to other placeholder configurers to resolve it.

    - #### setBeanName

          public void setBeanName(String beanName)

      Only necessary to check that we're not parsing our own bean definition, to avoid failing on unresolvable placeholders in properties file locations. The latter case can happen with placeholders for system properties in resource locations.
      指定者:
        `setBeanName` 在接口中 `BeanNameAware`
      参数:
        `beanName` - the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use the `BeanFactoryUtils.originalBeanName(String)` method to extract the original bean name (without suffix), if desired.
      另请参阅:
        `PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource...)`, `ResourceEditor`

    - #### setBeanFactory

          public void setBeanFactory(BeanFactory beanFactory)

      Only necessary to check that we're not parsing our own bean definition, to avoid failing on unresolvable placeholders in properties file locations. The latter case can happen with placeholders for system properties in resource locations.
      指定者:
        `setBeanFactory` 在接口中 `BeanFactoryAware`
      参数:
        `beanFactory` - owning BeanFactory (never `null`). The bean can immediately call methods on the factory.
      另请参阅:
        `PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource...)`, `ResourceEditor`

    - #### doProcessProperties

          protected void doProcessProperties(ConfigurableListableBeanFactory beanFactoryToProcess,
                                             org.springframework.util.StringValueResolver valueResolver)