Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » beans » factory » config » [javadoc | source]
org.springframework.beans.factory.config
public interface: InstantiationAwareBeanPostProcessor [javadoc | source]

All Implemented Interfaces:
    BeanPostProcessor

All Known Implementing Classes:
    AutowiredAnnotationBeanPostProcessor, ScriptFactoryPostProcessor, RequiredAnnotationBeanPostProcessor, CommonAnnotationBeanPostProcessor, DefaultAdvisorAutoProxyCreator, AnnotationAwareAspectJAutoProxyCreator, PersistenceAnnotationBeanPostProcessor, BeanNameAutoProxyCreator, SmartInstantiationAwareBeanPostProcessor, InfrastructureAdvisorAutoProxyCreator, InstantiationAwareBeanPostProcessorAdapter, AspectJAwareAdvisorAutoProxyCreator, AbstractAdvisorAutoProxyCreator, AbstractAutoProxyCreator

Subinterface of BeanPostProcessor that adds a before-instantiation callback, and a callback after instantiation but before explicit properties are set or autowiring occurs.

Typically used to suppress default instantiation for specific target beans, for example to create proxies with special TargetSources (pooling targets, lazily initializing targets, etc), or to implement additional injection strategies such as field injection.

NOTE: This interface is a special purpose interface, mainly for internal use within the framework. It is recommended to implement the plain BeanPostProcessor interface as far as possible, or to derive from InstantiationAwareBeanPostProcessorAdapter in order to be shielded from extensions to this interface.

Method from org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor Summary:
postProcessAfterInstantiation,   postProcessBeforeInstantiation,   postProcessPropertyValues
Method from org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor Detail:
 public boolean postProcessAfterInstantiation(Object bean,
    String beanName) throws BeansException
 public Object postProcessBeforeInstantiation(Class beanClass,
    String beanName) throws BeansException
    Apply this BeanPostProcessor before the target bean gets instantiated. The returned bean object may be a proxy to use instead of the target bean, effectively suppressing default instantiation of the target bean.

    If a non-null object is returned by this method, the bean creation process will be short-circuited. The only further processing applied is the #postProcessAfterInitialization callback from the configured BeanPostProcessors .

    This callback will only be applied to bean definitions with a bean class. In particular, it will not be applied to beans with a "factory-method".

    Post-processors may implement the extended SmartInstantiationAwareBeanPostProcessor interface in order to predict the type of the bean object that they are going to return here.

 public PropertyValues postProcessPropertyValues(PropertyValues pvs,
    PropertyDescriptor[] pds,
    Object bean,
    String beanName) throws BeansException
    Post-process the given property values before the factory applies them to the given bean. Allows for checking whether all dependencies have been satisfied, for example based on a "Required" annotation on bean property setters.

    Also allows for replacing the property values to apply, typically through creating a new MutablePropertyValues instance based on the original PropertyValues, adding or removing specific values.