@FunctionalInterface public interface BeanFactoryPostProcessor
Application contexts can auto-detect BeanFactoryPostProcessor beans in their bean definitions and apply them before any other beans get created.
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 implementing
BeanPostProcessor
instead.
BeanPostProcessor
,
PropertyResourceConfigurer
Modifier and Type | Method and Description |
---|---|
void |
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Modify the application context's internal bean factory after its standard
initialization.
|
void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
beanFactory
- the bean factory used by the application contextBeansException
- in case of errors