Advertisement

详细解读Spring Boot启动机制

阅读量:

初始化SpringApplication

1.main函数 ,执行run方法

2.new 一个SpringApplication对象

3.执行类变量的初始化

4.推断WebApplicationType,此处返回SERVLET

5.从META-INF/factories加载系统引导器BootstrapRegister

将AppInitiator配置为从META-INF/factories加载

7.从META-INF/factories加载应用监听器ApplicationListener

8.推断主程序类(main)

run SpringApplication对象

1.创建一个StopWatch 计时

2.计时开始

  1. 生成了一个DefaultBootstrapContext对象,并使初始化阶段的状态被显式地暴露出来

4.设置为headless模式

5.从META-INF/factories加载RunListeners

6.将springboot的状态暴露出去

7.将main函数传递的args参数封装到DefaultApplicationArguments

8.加载系统环境变量、和SpringBoot的配置文件(yaml等)的信息

9.设置IgnoreBeanInfo为true

10.设置banner 类信息

生成一个AnnotationCo

全部评论 (0)

还没有任何评论哟~