Example usage for org.springframework.beans.factory.config BeanPostProcessor postProcessBeforeInitialization

List of usage examples for org.springframework.beans.factory.config BeanPostProcessor postProcessBeforeInitialization

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config BeanPostProcessor postProcessBeforeInitialization.

Prototype

@Nullable
default Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException 

Source Link

Document

Apply this BeanPostProcessor to the given new bean instance before any bean initialization callbacks (like InitializingBean's afterPropertiesSet or a custom init-method).

Usage

From source file:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.java

@Override
public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName)
        throws BeansException {

    Object result = existingBean;
    for (BeanPostProcessor processor : getBeanPostProcessors()) {
        Object current = processor.postProcessBeforeInitialization(result, beanName);
        if (current == null) {
            return result;
        }//from   w  w  w. ja v  a2  s.  c o m
        result = current;
    }
    return result;
}