zoukankan      html  css  js  c++  java
  • [java]BeanPostProcessor使用及源码

    自定义BeanPostProcessor写法

    @Component
    public class MyBeanPostProcessor implements BeanPostProcessor {
    
        @Override
        public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
            System.out.println("postProcessBeforeInitialization... " + beanName);
            return bean;
        }
    
        @Override
        public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
            System.out.println("postProcessAfterInitialization... " + beanName);
            return bean;
        }
    }
    

    源码

    populateBean(beanName, mbd, instanceWrapper);
        exposedObject = initializeBean(beanName, exposedObject, mbd);
            wrappedBean = applyBeanPostProcessorsBeforeInitialization(wrappedBean, beanName);
            invokeInitMethods(beanName, wrappedBean, mbd);
            wrappedBean = applyBeanPostProcessorsAfterInitialization(wrappedBean, beanName);
    
  • 相关阅读:
    1月19日
    1月18日
    1月17日
    读后感(1)
    UIAlertView
    plist
    jQuery validation
    HTML <a href >标签的target属性
    HTML DOM
    .与..的区别
  • 原文地址:https://www.cnblogs.com/iiiiiher/p/13037733.html
Copyright © 2011-2022 走看看