Class ConfigurationPropertiesFactoryBean
- java.lang.Object
-
- org.apache.commons.configuration2.spring.ConfigurationPropertiesFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<java.util.Properties>
,org.springframework.beans.factory.InitializingBean
public class ConfigurationPropertiesFactoryBean extends java.lang.Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.FactoryBean<java.util.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:
Properties
,PropertiesLoaderSupport
-
-
Constructor Summary
Constructors Constructor Description ConfigurationPropertiesFactoryBean()
ConfigurationPropertiesFactoryBean(Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
CompositeConfiguration
getConfiguration()
Configuration[]
getConfigurations()
org.springframework.core.io.Resource[]
getLocations()
java.util.Properties
getObject()
java.lang.Class<?>
getObjectType()
boolean
isSingleton()
boolean
isThrowExceptionOnMissing()
void
setConfigurations(Configuration... configurations)
Set the commons configurations objects which will be used as properties.void
setLocations(org.springframework.core.io.Resource... locations)
Shortcut for loading compositeConfiguration from Spring resources.void
setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
Set the underlying Commons CompositeConfiguration throwExceptionOnMissing flag.
-
-
-
Constructor Detail
-
ConfigurationPropertiesFactoryBean
public ConfigurationPropertiesFactoryBean()
-
ConfigurationPropertiesFactoryBean
public ConfigurationPropertiesFactoryBean(Configuration configuration)
-
-
Method Detail
-
getObject
public java.util.Properties getObject() throws java.lang.Exception
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<java.util.Properties>
- Throws:
java.lang.Exception
- See Also:
FactoryBean.getObject()
-
getObjectType
public java.lang.Class<?> getObjectType()
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<java.util.Properties>
- See Also:
FactoryBean.getObjectType()
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<java.util.Properties>
- See Also:
FactoryBean.isSingleton()
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
- See Also:
InitializingBean.afterPropertiesSet()
-
getConfigurations
public Configuration[] getConfigurations()
-
setConfigurations
public void setConfigurations(Configuration... configurations)
Set the commons configurations objects which will be used as properties.- Parameters:
configurations
- commons configurations objects which will be used as properties.
-
getLocations
public org.springframework.core.io.Resource[] getLocations()
-
setLocations
public void setLocations(org.springframework.core.io.Resource... locations)
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
-
isThrowExceptionOnMissing
public boolean isThrowExceptionOnMissing()
-
setThrowExceptionOnMissing
public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
Set the underlying Commons CompositeConfiguration throwExceptionOnMissing flag.- Parameters:
throwExceptionOnMissing
- The new value for the property- See Also:
AbstractConfiguration.setThrowExceptionOnMissing(boolean)
-
getConfiguration
public CompositeConfiguration getConfiguration()
-
-