SpringBoot版本:2.1.1 ==》启动流程分析汇总
接上篇博客Spring Boot 2.1.1(十四)启动流程分析之refreshContext()
public ConfigurableApplicationContext run(String... args) {
....
try {
//本篇内容从本行开始记录
//空实现
afterRefresh(context, applicationArguments);
stopWatch.stop();
//打印启动日志
if (this.logStartupInfo) {
new StartupInfoLogger(this.mainApplicationClass)
.logStarted(getApplicationLog(), stopWatch);
}
//发布ApplicationStartedEvent事件
listeners.started(context);
//调用ApplicationRunner,CommandLineRunner的run方法
callRunners(context, applicationArguments);
....
}
catch (Throwable ex) {
handleRunFailure(context, ex, exceptionRepo