zoukankan      html  css  js  c++  java
  • 《精通Spring4.X企业应用开发实战》读后感第四章(Application中Bean的生命周期)

    package com.smart.beanfactory;
    
    import org.springframework.beans.BeansException;
    import org.springframework.beans.factory.config.BeanDefinition;
    import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
    import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
    
    public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
        // 对car <bean>的brand属性配置信息进行“偷梁换柱”的加工操作
        public void postProcessBeanFactory(ConfigurableListableBeanFactory bf) throws BeansException {
            BeanDefinition bd = bf.getBeanDefinition("car");
    
            bd.getPropertyValues().addPropertyValue("brand", "奇瑞QQ");
            System.out.println("调用BeanFactoryPostProcessor.postProcessBeanFactory().");
        }
    }

     

  • 相关阅读:
    生成器笔记
    迭代器笔记
    hashilib_module
    Ubuntu操作及各种命令笔记
    python正则表达式2
    python正则表达式1
    python文件操作(with关键字)
    python文件操作
    python包
    python模块
  • 原文地址:https://www.cnblogs.com/Michael2397/p/7953746.html
Copyright © 2011-2022 走看看