• spring中的bean后处理器


    package com.process;
    
    import org.springframework.beans.BeansException;
    import org.springframework.beans.factory.config.BeanPostProcessor;
    
    import com.action.LoginAction;
    
    public class FirstBeanPostProcess implements BeanPostProcessor {
    
        @Override
        public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
            System.out.println("bean后处理器在初始化bena"+beanName+"之前进行增强处理");
            return bean;
        }
    
        @Override
        public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
            System.out.println("bean后处理器在初始化bena"+beanName+"之后进行增强处理");
                if(bean instanceof LoginAction){
                    LoginAction loginAction = (LoginAction)bean;
                    loginAction.setTip("tiptipfrom beanpostprocess");
                }
            return bean;
        }
    
    }
  • 相关阅读:
    异或运算的运用
    HDU1251(统计难题)
    待解决题目
    tarjan算法模板
    FZU1465
    边双联通分量(构造边双联通图)
    UVa 12558
    codeforce Error Correct System
    codeforce The Art of Dealing with ATM
    ~0u >> 1
  • 原文地址:https://www.cnblogs.com/tingbogiu/p/5821393.html
Copyright © 2020-2023  润新知