Spring源码解读之获取Bean 上一篇文章我们搭建了源码环境,并使用了Spring方法获取了Bean,我们下边来回顾下代码 package com.pv3; import com.pv3.config.AnnotationConfig; import com.pv3.utils.TestUtil; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class Test { public static void main(String[] args) { //启动Spring AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(AnnotationConfig.class); TestUtil bean = annotationConfigApplicationContext.getBean(TestUtil.class); bean.hello(); } } Spring初始化做了什么? AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(AnnotationConfig.class); 1、AnnotationConfigA