package sping.analysis.postprocessor;
import java.beans.PropertyDescriptor;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;
import org.springframework.stereotype.Component;
/**
* Bean实例化之后做的增强
*
* @author slHuang
* @since 2019-02-12
*/
@Component
public class MyInstantiationAwareBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter {
@Override
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
System.out.println(this.getClass().getName() + ".postProcessBeforeInstantiation()被调用 了...");
return super.postProcessBeforeInstantiation(beanClass, beanName);
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
System.out.println(this.getClass().getName() + ".postProcessAfterInitialization()被调用 了...");
return super.postProcessAfterInitialization(bean, beanName);
}
@Override
public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, String beanName)
throws BeansException {
System.out.println(this.getClass().getName() + ".postProcessProperties()被调用 了...");
return super.postProcessProperties(pvs, bean, beanName);
}
@Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean,
String beanName) throws BeansException {
System.out.println(this.getClass().getName() + ".postProcessPropertyValues()被调用 了...");
return super.postProcessPropertyValues(pvs, pds, bean, beanName);
}
}
版权声明:本文为hsl0530hsl原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。