Class PropertyResourceConfigurer
- All Implemented Interfaces:
- BeanFactoryPostProcessor, Ordered, PriorityOrdered
- Direct Known Subclasses:
- PlaceholderConfigurerSupport, PropertyOverrideConfigurer
Two concrete implementations are provided in the distribution:
- PropertyOverrideConfigurerfor "beanName.property=value" style overriding (pushing values from a properties file into bean definitions)
- PropertyPlaceholderConfigurerfor replacing "${...}" placeholders (pulling values from a properties file into bean definitions)
Property values can be converted after reading them in, through overriding
the convertPropertyValue(String) method. For example, encrypted values
can be detected and decrypted accordingly before processing them.
- Since:
- 02.10.2003
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from class PropertiesLoaderSupportlocalOverride, localProperties, loggerFields inherited from interface OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidconvertProperties(Properties props) Convert the given merged properties, converting property values if necessary.protected StringconvertProperty(String propertyName, String propertyValue) Convert the given property from the properties source to the value which should be applied.protected StringconvertPropertyValue(String originalValue) Convert the given property value from the properties source to the value which should be applied.intgetOrder()Get the order value of this object.voidpostProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) protected abstract voidprocessProperties(ConfigurableListableBeanFactory beanFactory, Properties props) Apply the given Properties to the given BeanFactory.voidsetOrder(int order) Set the order value of this object for sorting purposes.Methods inherited from class PropertiesLoaderSupportloadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
- 
Constructor Details- 
PropertyResourceConfigurerpublic PropertyResourceConfigurer()
 
- 
- 
Method Details- 
setOrderpublic void setOrder(int order) Set the order value of this object for sorting purposes.- See Also:
 
- 
getOrderpublic int getOrder()Description copied from interface:OrderedGet the order value of this object.Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet load-on-startupvalues).Same order values will result in arbitrary sort positions for the affected objects. 
- 
postProcessBeanFactorypublic void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException - Specified by:
- postProcessBeanFactoryin interface- BeanFactoryPostProcessor
- Parameters:
- beanFactory- the bean factory used by the application context
- Throws:
- BeanInitializationException- if any properties cannot be loaded
- BeansException- in case of errors
 
- 
convertPropertiesConvert the given merged properties, converting property values if necessary. The result will then be processed.The default implementation will invoke convertPropertyValue(String)for each property value, replacing the original with the converted value.- Parameters:
- props- the Properties to convert
- See Also:
 
- 
convertPropertyConvert the given property from the properties source to the value which should be applied.The default implementation calls convertPropertyValue(String).- Parameters:
- propertyName- the name of the property that the value is defined for
- propertyValue- the original value from the properties source
- Returns:
- the converted value, to be used for processing
- See Also:
 
- 
convertPropertyValueConvert the given property value from the properties source to the value which should be applied.The default implementation simply returns the original value. Can be overridden in subclasses, for example to detect encrypted values and decrypt them accordingly. - Parameters:
- originalValue- the original value from the properties source (properties file or local "properties")
- Returns:
- the converted value, to be used for processing
- See Also:
 
- 
processPropertiesprotected abstract void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException Apply the given Properties to the given BeanFactory.- Parameters:
- beanFactory- the BeanFactory used by the application context
- props- the Properties to apply
- Throws:
- BeansException- in case of errors
 
 
-