Top Description Methods
org.springframework.beans.factory.config

public Interface BeanFactoryPostProcessor

Known Direct Subinterfaces
org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
Known Direct Implementers
org.springframework.beans.factory.config.CustomEditorConfigurer, org.springframework.beans.factory.config.CustomScopeConfigurer, org.springframework.beans.factory.config.DeprecatedBeanWarner, org.springframework.beans.factory.config.PropertyResourceConfigurer, org.springframework.beans.factory.annotation.CustomAutowireConfigurer
Annotations
@FunctionalInterface
Imports
org.springframework.beans.BeansException

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 implementing BeanPostProcessor instead.

Registration

An ApplicationContext auto-detects BeanFactoryPostProcessor beans in its bean definitions and applies them before any other beans get created. A BeanFactoryPostProcessor may also be registered programmatically with a ConfigurableApplicationContext.

Ordering

BeanFactoryPostProcessor beans that are autodetected in an ApplicationContext will be ordered according to org.springframework.core.PriorityOrdered and org.springframework.core.Ordered semantics. In contrast, BeanFactoryPostProcessor beans that are registered programmatically with a ConfigurableApplicationContext will be applied in the order of registration; any ordering semantics expressed through implementing the PriorityOrdered or Ordered interface will be ignored for programmatically registered post-processors. Furthermore, the @Order annotation is not taken into account for BeanFactoryPostProcessor beans.

Authors
Juergen Hoeller, Sam Brannen
Since
06.07.2003
See Also
BeanPostProcessor, PropertyResourceConfigurer

Method Summary

Modifier and TypeMethod and Description
public void
postProcessBeanFactory(ConfigurableListableBeanFactory
the bean factory used by the application context
beanFactory
)

Modify the application context's internal bean factory after its standard initialization.

Method Detail

postProcessBeanFactoryback to summary
public 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.

Parameters
beanFactory:ConfigurableListableBeanFactory

the bean factory used by the application context

Exceptions
BeansException:
in case of errors