因为是手写模拟Spring代码,所以没有特殊的笔记,请直接看视频,建议同学们抽空自己也写一个Spring出来,加深理解。

git clone地址:https://gitee.com/archguide/zhouyu-spring.git

课程内容:

  1. 通过手写模拟,了解Spring的底层源码启动过程

  2. 通过手写模拟,了解BeanDefinition、BeanPostProcessor的概念

  3. 通过手写模拟,了解Spring解析配置类等底层源码工作流程

  4. 通过手写模拟,了解依赖注入,Aware回调等底层源码工作流程

  5. 通过手写模拟,了解Spring AOP的底层源码工作流程

简单手写Spring

  1. 用软件设计的思想, 先定义接口(功能)
    1. 创建ApplicationContext,
    2. 定义getBean的方法
  2. 按照定义去实现代码
aa
        // 1. 创建容器
        LiaoHaoApplicationContext applicationContext = new LiaoHaoApplicationContext(AppConfig.class);

        // 从容器中获取对象
        UserService userService = (UserService) applicationContext.getBean("userService");

        // 使用对象
        userService.test();