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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Resource[]
Class<?>
boolean
boolean
void
setConfigurations
(Configuration... configurations) Sets the commons configurations objects which will be used as properties.void
setLocations
(Resource... locations) Shortcut for loading compositeConfiguration from Spring resources.void
setThrowExceptionOnMissing
(boolean throwExceptionOnMissing) Sets the underlying Commons CompositeConfiguration throwExceptionOnMissing flag.
-
Constructor Details
-
ConfigurationPropertiesFactoryBean
public ConfigurationPropertiesFactoryBean() -
ConfigurationPropertiesFactoryBean
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
- See Also:
-
getConfiguration
-
getConfigurations
-
getLocations
-
getObject
- Specified by:
getObject
in interfaceFactoryBean<Properties>
- Throws:
Exception
- See Also:
-
getObjectType
- Specified by:
getObjectType
in interfaceFactoryBean<Properties>
- See Also:
-
isSingleton
- Specified by:
isSingleton
in 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:
-