类 PropertiesLoaderSupport
- 从以下版本开始:
- 4.0 2021/12/12 14:34
- 作者:
- Juergen Hoeller, Harry Yang
-
字段概要
字段修饰符和类型字段说明private Stringprivate booleanprotected booleanprotected Properties[]private Resource[]protected final LoggerLogger available to subclasses.private PropertiesPersister -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voidloadProperties(Properties props) Load properties into the given instance.protected PropertiesReturn a merged Properties instance containing both the loaded properties and properties set on this FactoryBean.voidsetFileEncoding(String encoding) Set the encoding to use for parsing properties files.voidsetIgnoreResourceNotFound(boolean ignoreResourceNotFound) Set if failure to find the property resource should be ignored.voidsetLocalOverride(boolean localOverride) Set whether local properties override properties from files.voidsetLocation(Resource location) Set a location of a properties file to be loaded.voidsetLocations(Resource... locations) Set locations of properties files to be loaded.voidsetProperties(Properties properties) Set local properties, e.g. via the "props" tag in XML bean definitions.voidsetPropertiesArray(Properties... propertiesArray) Set local properties, e.g. via the "props" tag in XML bean definitions, allowing for merging multiple properties sets into one.voidsetPropertiesPersister(PropertiesPersister propertiesPersister) Set the PropertiesPersister to use for parsing properties files.
-
字段详细资料
-
logger
Logger available to subclasses. -
localProperties
-
localOverride
protected boolean localOverride -
locations
-
ignoreResourceNotFound
private boolean ignoreResourceNotFound -
fileEncoding
-
propertiesPersister
-
-
构造器详细资料
-
PropertiesLoaderSupport
public PropertiesLoaderSupport()
-
-
方法详细资料
-
setProperties
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
Set local properties, e.g. via the "props" tag in XML bean definitions, allowing for merging multiple properties sets into one. -
setLocation
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
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
Set the encoding to use for parsing properties files.Default is none, using the
java.util.Propertiesdefault encoding.Only applies to classic properties files, not to XML files.
-
setPropertiesPersister
Set the PropertiesPersister to use for parsing properties files. The default is ResourcePropertiesPersister. -
mergeProperties
Return a merged Properties instance containing both the loaded properties and properties set on this FactoryBean.- 抛出:
IOException
-
loadProperties
Load properties into the given instance.- 参数:
props- the Properties instance to load into- 抛出:
IOException- in case of I/O errors- 另请参阅:
-