org.springframework.core.io.support

## 类 PropertiesLoaderSupport

- java.lang.Object
- - org.springframework.core.io.support.PropertiesLoaderSupport

-     public abstract class PropertiesLoaderSupport
      extends Object

  Base class for JavaBean-style components that need to load properties from one or more resources. Supports local properties as well, with configurable overriding.
  从以下版本开始:
    1.2.2
  作者:
    Juergen Hoeller

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected boolean` | `localOverride`
    `protected Properties[]` | `localProperties`
    `protected Log` | `logger` Logger available to subclasses

  - ### 构造器概要

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

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `loadProperties(Properties props)` Load properties into the given instance.
    `protected Properties` | `mergeProperties()` Return a merged Properties instance containing both the loaded properties and properties set on this FactoryBean.
    `void` | `setFileEncoding(String encoding)` Set the encoding to use for parsing properties files.
    `void` | `setIgnoreResourceNotFound(boolean ignoreResourceNotFound)` Set if failure to find the property resource should be ignored.
    `void` | `setLocalOverride(boolean localOverride)` Set whether local properties override properties from files.
    `void` | `setLocation(Resource location)` Set a location of a properties file to be loaded.
    `void` | `setLocations(Resource... locations)` Set locations of properties files to be loaded.
    `void` | `setProperties(Properties properties)` Set local properties, e.g. via the "props" tag in XML bean definitions.
    `void` | `setPropertiesArray(Properties... propertiesArray)` Set local properties, e.g. via the "props" tag in XML bean definitions, allowing for merging multiple properties sets into one.
    `void` | `setPropertiesPersister(PropertiesPersister propertiesPersister)` Set the PropertiesPersister to use for parsing properties files.

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

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

- - ### 字段详细资料

    - #### logger

          protected final Log logger

      Logger available to subclasses

    - #### localProperties

          @Nullable
          protected Properties[] localProperties

    - #### localOverride

          protected boolean localOverride

  - ### 构造器详细资料

    - #### PropertiesLoaderSupport

          public PropertiesLoaderSupport()

  - ### 方法详细资料

    - #### setProperties

          public void setProperties(Properties properties)

      Set local properties, e.g. via the "props" tag in XML bean definitions. These can be considered defaults, to be overridden by properties loaded from files.

    - #### setPropertiesArray

          public void setPropertiesArray(Properties... propertiesArray)

      Set local properties, e.g. via the "props" tag in XML bean definitions, allowing for merging multiple properties sets into one.

    - #### setLocation

          public void setLocation(Resource location)

      Set a location of a properties file to be loaded.

      Can point to a classic properties file or to an XML file that follows JDK 1.5's properties XML format.

    - #### setLocations

          public void setLocations(Resource... locations)

      Set locations of properties files to be loaded.

      Can point to classic properties files or to XML files that follow JDK 1.5's properties XML format.

      Note: Properties defined in later files will override properties defined earlier files, in case of overlapping keys. Hence, make sure that the most specific files are the last ones in the given list of locations.

    - #### setLocalOverride

          public void setLocalOverride(boolean localOverride)

      Set whether local properties override properties from files.

      Default is "false": Properties from files override local defaults. Can be switched to "true" to let local properties override defaults from files.

    - #### setIgnoreResourceNotFound

          public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)

      Set if failure to find the property resource should be ignored.

      "true" is appropriate if the properties file is completely optional. Default is "false".

    - #### setFileEncoding

          public void setFileEncoding(String encoding)

      Set the encoding to use for parsing properties files.

      Default is none, using the `java.util.Properties` default encoding.

      Only applies to classic properties files, not to XML files.

      另请参阅:
        `PropertiesPersister.load(java.util.Properties, java.io.InputStream)`

    - #### setPropertiesPersister

          public void setPropertiesPersister(@Nullable
                                             PropertiesPersister propertiesPersister)

      Set the PropertiesPersister to use for parsing properties files. The default is DefaultPropertiesPersister.
      另请参阅:
        `DefaultPropertiesPersister`

    - #### mergeProperties

          protected Properties mergeProperties()
                                        throws IOException

      Return a merged Properties instance containing both the loaded properties and properties set on this FactoryBean.
      抛出:
        `IOException`

    - #### loadProperties

          protected void loadProperties(Properties props)
                                 throws IOException

      Load properties into the given instance.
      参数:
        `props` - the Properties instance to load into
      抛出:
        `IOException` - in case of I/O errors
      另请参阅:
        `setLocations(org.springframework.core.io.Resource...)`