org.springframework.beans.factory.config.BeanFactoryPostProcessor:
package org.springframework.beans.factory.config;
public interface BeanFactoryPostProcessor {
public void postProcessBeanFactory(
ConfigurableListableBeanFactory beanFactory) throws BeansException;
}
假设您有一个类MyClass实例了BeanFactoryPostProcessor,则您可以在Bean定义档中定义它:
....
<beans>
<bean id="beanFactoryModifier"
class="onlyfun.caterpillar.SomeClass"/>
....
</beans>
使用ApplicationContext时,若Bean定义档中有定义实例化的BeanFactoryPostProcessor的类别,则ApplicationContext会自动应用。
在Spring中有几个BeanFactoryPostProcessor的实作实例,像是:
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
org.springframework.beans.factory.config.PropertyOverrideConfigurer
org.springframework.beans.factory.config.CustomEditorConfigurer。