SpringBoot启动流程图

代码

@startuml
client -> SpringApplication : run(Class<?>, String[])
SpringApplication -> SpringApplication : new
activate SpringApplication #ABA
	SpringApplication -[#F2D]> ApplicationContextInitializer : 加载【META-INF/spring.factories】初始化ApplicationContextInitializer
	SpringApplication -> ApplicationListener : 加载【META-INF/spring.factories】初始化ApplicationListener
deactivate
SpringApplication -> SpringApplication : run
activate SpringApplication #FBF
	SpringApplication -> SpringApplicationRunListener : 加载【META-INF/spring.factories】初始化SpringApplicationRunListener(SpringApplication,String[])
	SpringApplication -[#18F]> SpringApplicationRunListeners : 使用SpringApplicationRunListener初始化SpringApplicationRunListeners
	SpringApplication -[#18F]> SpringApplicationRunListeners : starting()【1.启动中】
	SpringApplication -[#F11]> ApplicationArguments : new DefaultApplicationArguments(String[])
	SpringApplication -> ConfigurableEnvironment : 根据当前环境初始化、配置
	SpringApplication -[#18F]> SpringApplicationRunListeners : environmentPrepared()【2.环境准备完成】
	SpringApplication -> SpringApplication : bindToSpringApplication 绑定配置到当前SpringApplication对象,前缀spring.main
	SpringApplication -> Banner : 打印banner
	SpringApplication -[#296]> ConfigurableApplicationContext : 反射初始化ConfigurableApplicationContext
	SpringApplication -> SpringBootExceptionReporter : 加载【META-INF/spring.factories】初始化SpringBootExceptionReporter(ConfigurableApplicationContext)
	SpringApplication -> SpringApplication : prepareContext
	activate SpringApplication #ADC
		SpringApplication -[#296]> ConfigurableApplicationContext : setEnvironment
		SpringApplication -[#296]> ConfigurableApplicationContext : postProcessApplicationContext
		SpringApplication -[#F2D]> ApplicationContextInitializer : initialize
		SpringApplication -[#18F]> SpringApplicationRunListeners : contextPrepared()【3.上下文初始化完成】
		SpringApplication -> BeanDefinitionLoader : 创建加载器
		SpringApplication -> BeanDefinitionLoader : load()加载元数据
		SpringApplication -[#18F]> SpringApplicationRunListeners : contextLoaded()【4.上下文加载完成】
	deactivate
	SpringApplication -[#296]> ConfigurableApplicationContext : refresh()初始化上下文bean
	SpringApplication -[#18F]> SpringApplicationRunListeners : started()【5.上下文启动完成】
	SpringApplication -[#296]> ConfigurableApplicationContext : 获取ApplicationRunner实例
	SpringApplication -[#296]> ConfigurableApplicationContext : 获取CommandLineRunner实例
	SpringApplication -> SpringApplication : ApplicationRunner和CommandLineRunner整体排序后调用
	SpringApplication -[#18F]> SpringApplicationRunListeners : running()【6.上下文运行中】
deactivate
@enduml
posted @ 2021-05-19 15:52  java拌饭  阅读(652)  评论(0编辑  收藏  举报