接口 BeanFactoryPostProcessor
- 所有已知实现类:
AspectJWeavingEnabler
,ConfigurationClassPostProcessor
,CustomAutowireConfigurer
,CustomEditorConfigurer
,CustomScopeConfigurer
,DeprecatedBeanWarner
,EventListenerMethodProcessor
,PlaceholderConfigurerSupport
,PreferencesPlaceholderConfigurer
,PropertyOverrideConfigurer
,PropertyPlaceholderConfigurer
,PropertyResourceConfigurer
,PropertySourcesPlaceholderConfigurer
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface BeanFactoryPostProcessor
Factory hook that allows for custom modification of an application context's bean definitions, adapting the bean property values of the context's underlying bean factory.Useful for custom config files targeted at system administrators that override bean properties configured in the application context. See
PropertyResourceConfigurer
and its concrete implementations for out-of-the-box solutions that address such configuration needs.A
BeanFactoryPostProcessor
may interact with and modify bean definitions, but never bean instances. Doing so may cause premature bean instantiation, violating the container and causing unintended side-effects. If bean instance interaction is required, consider implementingBeanPostProcessor
instead.Registration
An
ApplicationContext
auto-detectsBeanFactoryPostProcessor
beans in its bean definitions and applies them before any other beans get created. ABeanFactoryPostProcessor
may also be registered programmatically with aConfigurableApplicationContext
.Ordering
BeanFactoryPostProcessor
beans that are autodetected in anApplicationContext
will be ordered according toPriorityOrdered
andOrdered
semantics. In contrast,BeanFactoryPostProcessor
beans that are registered programmatically with aConfigurableApplicationContext
will be applied in the order of registration; any ordering semantics expressed through implementing thePriorityOrdered
orOrdered
interface will be ignored for programmatically registered post-processors. Furthermore, the@Order
annotation is not taken into account forBeanFactoryPostProcessor
beans.- 从以下版本开始:
- 06.07.2003
- 作者:
- Juergen Hoeller, Sam Brannen
- 另请参阅:
BeanPostProcessor
,PropertyResourceConfigurer
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 void
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Modify the application context's internal bean factory after its standard initialization.
方法详细资料
postProcessBeanFactory
void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
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.- 参数:
beanFactory
- the bean factory used by the application context- 抛出:
BeansException
- in case of errors