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 java.util.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.
Properties
,
PropertiesLoaderSupport
Constructor and Description |
---|
ConfigurationPropertiesFactoryBean() |
ConfigurationPropertiesFactoryBean(Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
CompositeConfiguration |
getConfiguration() |
Configuration[] |
getConfigurations() |
Resource[] |
getLocations() |
Properties |
getObject() |
Class<?> |
getObjectType() |
boolean |
isSingleton() |
boolean |
isThrowExceptionOnMissing() |
void |
setConfigurations(Configuration... configurations)
Set 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)
Set the underlying Commons CompositeConfiguration throwExceptionOnMissing flag.
|
public ConfigurationPropertiesFactoryBean()
public ConfigurationPropertiesFactoryBean(Configuration configuration)
public Properties getObject() throws Exception
getObject
in interface FactoryBean<Properties>
Exception
FactoryBean.getObject()
public Class<?> getObjectType()
getObjectType
in interface FactoryBean<Properties>
FactoryBean.getObjectType()
public boolean isSingleton()
isSingleton
in interface FactoryBean<Properties>
FactoryBean.isSingleton()
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
InitializingBean.afterPropertiesSet()
public Configuration[] getConfigurations()
public void setConfigurations(Configuration... configurations)
configurations
- commons configurations objects which will be used as properties.public Resource[] getLocations()
public void setLocations(Resource... locations)
locations
- resources of configuration filespublic boolean isThrowExceptionOnMissing()
public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
throwExceptionOnMissing
- The new value for the propertyAbstractConfiguration.setThrowExceptionOnMissing(boolean)
public CompositeConfiguration getConfiguration()
Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.