Class ConfigurationPropertiesFactoryBean
java.lang.Object
org.apache.commons.configuration2.spring.ConfigurationPropertiesFactoryBean
- All Implemented Interfaces:
FactoryBean<Properties>,InitializingBean
public class ConfigurationPropertiesFactoryBean
extends Object
implements InitializingBean, FactoryBean<Properties>
FactoryBean which wraps a Commons CompositeConfiguration object for usage with PropertiesLoaderSupport. This allows
the compositeConfiguration object to behave like a normal Properties object which can be passed on to
setProperties() method allowing PropertyOverrideConfigurer and PropertyPlaceholderConfigurer to take advantage of
Commons Configuration.
Internally a CompositeConfiguration object is used for merging multiple Configuration objects.
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidResource[]Class<?>booleanbooleanvoidsetConfigurations(Configuration... configurations) Sets the commons configurations objects which will be used as properties.voidsetLocations(Resource... locations) Shortcut for loading compositeConfiguration from Spring resources.voidsetThrowExceptionOnMissing(boolean throwExceptionOnMissing) Sets the underlying Commons CompositeConfiguration throwExceptionOnMissing flag.
-
Constructor Details
-
ConfigurationPropertiesFactoryBean
public ConfigurationPropertiesFactoryBean() -
ConfigurationPropertiesFactoryBean
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Throws:
Exception- See Also:
-
getConfiguration
-
getConfigurations
-
getLocations
-
getObject
- Specified by:
getObjectin interfaceFactoryBean<Properties>- Throws:
Exception- See Also:
-
getObjectType
- Specified by:
getObjectTypein interfaceFactoryBean<Properties>- See Also:
-
isSingleton
- Specified by:
isSingletonin interfaceFactoryBean<Properties>- See Also:
-
isThrowExceptionOnMissing
-
setConfigurations
Sets the commons configurations objects which will be used as properties.- Parameters:
configurations- commons configurations objects which will be used as properties.
-
setLocations
Shortcut for loading compositeConfiguration from Spring resources. It will internally create a PropertiesConfiguration object based on the URL retrieved from the given Resources.- Parameters:
locations- resources of configuration files
-
setThrowExceptionOnMissing
Sets the underlying Commons CompositeConfiguration throwExceptionOnMissing flag.- Parameters:
throwExceptionOnMissing- The new value for the property- See Also:
-