public abstract class PropertiesLoaderSupport extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
localOverride |
protected Properties[] |
localProperties |
protected org.slf4j.Logger |
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.
|
protected final org.slf4j.Logger logger
protected Properties[] localProperties
protected boolean localOverride
public void setProperties(Properties properties)
public void setPropertiesArray(Properties... propertiesArray)
public void setLocation(Resource location)
Can point to a classic properties file or to an XML file that follows JDK 1.5's properties XML format.
public void setLocations(Resource... locations)
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.
public void setLocalOverride(boolean localOverride)
Default is "false": Properties from files override local defaults. Can be switched to "true" to let local properties override defaults from files.
public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)
"true" is appropriate if the properties file is completely optional. Default is "false".
public void setFileEncoding(String encoding)
Default is none, using the java.util.Properties
default encoding.
Only applies to classic properties files, not to XML files.
org.springframework.util.PropertiesPersister#loadpublic void setPropertiesPersister(PropertiesPersister propertiesPersister)
org.springframework.util.DefaultPropertiesPersisterprotected Properties mergeProperties() throws IOException
IOExceptionprotected void loadProperties(Properties props) throws IOException
props - the Properties instance to load intoIOException - in case of I/O errorssetLocations(cn.sexycode.util.core.io.Resource...)Copyright © 2020. All rights reserved.