Two concrete implementations are provided in the distribution:
PropertyOverrideConfigurer for "beanName.property=value" style overriding
(pushing values from a properties file into bean definitions)
PropertyPlaceholderConfigurer for replacing "${...}" placeholders
(pulling values from a properties file into bean definitions)
Property values can be converted after reading them in, through overriding
the convertPropertyValue method. For example, encrypted values
can be detected and decrypted accordingly before processing them.
PropertyOverrideConfigurer, PropertyPlaceholderConfigurer
| Modifier and Type | Field and Description |
|---|---|
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | convertProperties(Properties
the Properties to convert props)Convert the given merged properties, converting property values if necessary. |
| protected String | Returns: the converted value, to be used for processingthe name of the property that the value is defined for propertyName, String the original value from the properties source propertyValue)Convert the given property from the properties source to the value which should be applied. |
| protected String | Returns: the converted value, to be used for processingthe original value from the properties source
(properties file or local "properties") originalValue)Convert the given property value from the properties source to the value which should be applied. |
| public int | |
| public void | postProcessBeanFactory(ConfigurableListableBeanFactory
the bean factory used by the application context beanFactory)Implements org. |
| protected abstract void | processProperties(ConfigurableListableBeanFactory
the BeanFactory used by the application context beanFactory, Properties the Properties to apply props)Apply the given Properties to the given BeanFactory. |
| public void |
| order | back to summary |
|---|---|
| private int order | |
| PropertyResourceConfigurer | back to summary |
|---|---|
| public PropertyResourceConfigurer() | |
| convertProperties | back to summary |
|---|---|
| protected void convertProperties(Properties props) Convert the given merged properties, converting property values if necessary. The result will then be processed. The default implementation will invoke
| |
| convertProperty | back to summary |
|---|---|
| protected String convertProperty(String propertyName, String propertyValue) Convert the given property from the properties source to the value which should be applied. The default implementation calls
| |
| convertPropertyValue | back to summary |
|---|---|
| protected String convertPropertyValue(String originalValue) Convert 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.
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. Get 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 Same order values will result in arbitrary sort positions for the affected objects.
| |
| postProcessBeanFactory | back to summary |
|---|---|
| public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException Implements org. Merge, convert and process properties against the given bean factory.
| |
| processProperties | back to summary |
|---|---|
| protected abstract void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException Apply the given Properties to the given BeanFactory.
| |
| setOrder | back to summary |
|---|---|
| public void setOrder(int order) Set the order value of this object for sorting purposes.
| |