org.springframework.core.io.support
Class PropertiesLoaderSupport

public class PropertiesLoaderSupport
Base class for JavaBean-style components that need to load properties from one or more resources. Supports local properties as well, with configurable overriding.
Since1.2.2
VersionNot specified.
AuthorJuergen Hoeller
Wiki javadoc Use textile entry format.
Add your comments here.
Field Summary
protected Log logger
Logger available to subclasses
static String XML_FILE_EXTENSION
No description provided.
Constructor Summary
PropertiesLoaderSupport()
No description provided.
Method Summary
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.
void setPropertiesArray( Properties [] propertiesArray )
Set local properties, e.g.
void setPropertiesPersister( PropertiesPersister propertiesPersister )
Set the PropertiesPersister to use for parsing properties files.
logger
protected Log logger
Logger available to subclasses
Wiki javadoc Use textile entry format.
Add your comments here.
XML_FILE_EXTENSION
public static String XML_FILE_EXTENSION
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
PropertiesLoaderSupport
public PropertiesLoaderSupport ( )
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
loadProperties
protected void loadProperties ( Properties props )
throws
Load properties into the given instance.
Parameters
TypeNameDescription
Properties props the Properties instance to load into
Returns void No description provided.
Exceptions
IOException in case of I/O errors
Wiki javadoc Use textile entry format.
Add your comments here.
mergeProperties
protected Properties mergeProperties ( )
throws
Return a merged Properties instance containing both the loaded properties and properties set on this FactoryBean.
Exceptions
IOException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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.

Parameters
TypeNameDescription
String encoding No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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".
Parameters
TypeNameDescription
boolean ignoreResourceNotFound No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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.
Parameters
TypeNameDescription
boolean localOverride No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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.

Parameters
TypeNameDescription
Resource location No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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.

Parameters
TypeNameDescription
Resource [] locations No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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.
Parameters
TypeNameDescription
Properties properties No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
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.
Parameters
TypeNameDescription
Properties [] propertiesArray No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setPropertiesPersister
public void setPropertiesPersister ( PropertiesPersister propertiesPersister )
Set the PropertiesPersister to use for parsing properties files. The default is DefaultPropertiesPersister.
Parameters
TypeNameDescription
PropertiesPersister propertiesPersister No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.