## org.springframework.beans.factory.config
Class PropertyResourceConfigurer

    java.lang.Object
      org.springframework.core.io.support.PropertiesLoaderSupport
          org.springframework.beans.factory.config.PropertyResourceConfigurer

All Implemented Interfaces:
  BeanFactoryPostProcessor, Ordered, PriorityOrdered

Direct Known Subclasses:
  PropertyOverrideConfigurer, PropertyPlaceholderConfigurer

    public abstract class PropertyResourceConfigurer

extends PropertiesLoaderSupport
implements BeanFactoryPostProcessor, PriorityOrdered

Allows for configuration of individual bean property values from a property resource, i.e. a properties file. Useful for custom config files targetted at system administrators that override bean properties configured in the application context.

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(java.lang.String)` method. For example, encrypted values can be detected and decrypted accordingly before processing them.

Since:
  02.10.2003
Author:
  Juergen Hoeller
See Also:
  `PropertyOverrideConfigurer`, `PropertyPlaceholderConfigurer`

Field Summary

Fields inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
`logger, XML_FILE_EXTENSION`

Fields inherited from interface org.springframework.core.Ordered
`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

Constructor Summary
`PropertyResourceConfigurer()`

Method Summary
`protected void` `convertProperties(Properties props)` Convert the given merged properties, converting property values if necessary.
`protected String` `convertPropertyValue(String originalValue)` Convert the given property value from the properties source to the value that should be applied.
`int` `getOrder()` Return the order value of this object, with a higher value meaning greater in terms of sorting.
`void` `postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)` Modify the application context's internal bean factory after its standard initialization.
`protected abstract void` `processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)` Apply the given Properties to the given BeanFactory.
`void` `setOrder(int order)`

Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
`loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyResourceConfigurer

    public PropertyResourceConfigurer()

Method Detail

### setOrder

    public void setOrder(int order)

### getOrder

    public int getOrder()

  Description copied from interface: `Ordered`
  Return the order value of this object, with a higher value meaning greater in terms of sorting.

  Normally starting with 0 or 1, with `Ordered.LOWEST_PRECEDENCE` indicating greatest. Same order values will result in arbitrary positions for the affected objects.

  Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).

  Note that order values below 0 are reserved for framework purposes. Application-specified values should always be 0 or greater, with only framework components (internal or third-party) supposed to use lower values.

  Specified by:
    `getOrder` in interface `Ordered`
  Returns:
    the order value
  See Also:
    `Ordered.LOWEST_PRECEDENCE`

### postProcessBeanFactory

    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
                                throws BeansException

  Description copied from interface: `BeanFactoryPostProcessor`
  Modify the application context's internal bean factory after its standard initialization. All bean definitions will have been loaded, but no beans will have been instantiated yet. This allows for overriding or adding properties even to eager-initializing beans.

  Specified by:
    `postProcessBeanFactory` in interface `BeanFactoryPostProcessor`
  Parameters:
    `beanFactory` - the bean factory used by the application context
  Throws:
    `BeansException` - in case of errors

### convertProperties

    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 `convertPropertyValue(java.lang.String)` for each property value, replacing the original with the converted value.

  Parameters:
    `props` - the Properties to convert
  See Also:
    `processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.util.Properties)`

### convertPropertyValue

    protected String convertPropertyValue(String originalValue)

  Convert the given property value from the properties source to the value that 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:
    `PropertiesLoaderSupport.setProperties(java.util.Properties)`, `PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource[])`, `PropertiesLoaderSupport.setLocation(org.springframework.core.io.Resource)`

### processProperties

    protected 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

Copyright © 2002-2008 The Spring Framework.