org.springframework.beans.factory.config
Class PropertyOverrideConfigurer
java.lang.Object
org.springframework.beans.factory.config.PropertyResourceConfigurer
org.springframework.beans.factory.config.PropertyOverrideConfigurer
- All Implemented Interfaces:
- BeanFactoryPostProcessor, Ordered
- public class PropertyOverrideConfigurer
- extends PropertyResourceConfigurer
A property resource configurer that overrides bean property values in an application
context definition. It pushes values from a properties file into bean definitions.
Configuration lines are expected to be of the following form:
beanName.property=value
Example properties file:
dataSource.driverClassName=com.mysql.jdbc.Driver
dataSource.url=jdbc:mysql:mydb
In contrast to PropertyPlaceholderConfigurer, the original definition can have default
values or no values at all for such bean properties. If an overriding properties file does
not have an entry for a certain bean property, the default context definition is used.
Note that the context definition is not aware of being overridden;
so this is not immediately obvious when looking at the XML definition file.
In case of multiple PropertyOverrideConfigurers that define different values for
the same bean property, the last one will win (due to the overriding mechanism).
- Since:
- 12.03.2003
- Version:
- $Id: PropertyOverrideConfigurer.java,v 1.6 2004/04/22 07:58:22 jhoeller Exp $
- Author:
- Juergen Hoeller
- See Also:
PropertyPlaceholderConfigurer
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertyOverrideConfigurer
public PropertyOverrideConfigurer()
processProperties
protected void processProperties(ConfigurableListableBeanFactory beanFactory,
java.util.Properties props)
throws BeansException
- Description copied from class:
PropertyResourceConfigurer
- Apply the given Properties to the bean factory.
- Specified by:
processProperties
in class PropertyResourceConfigurer
- Parameters:
beanFactory
- the bean factory used by the application contextprops
- the Properties to apply
- Throws:
BeansException
- in case of errors
processKey
protected void processKey(ConfigurableListableBeanFactory factory,
java.lang.String key,
java.lang.String value)
throws BeansException
- Process the given key as 'beanName.property' entry.
- Throws:
BeansException
Copyright (C) 2003-2004 The Spring Framework Project.