与spring和springboot相关的重要逻辑,如果想了解源头在哪,找refresh准没错
启动类,run
@SpringBootApplication
public class KafkaBootApplication {
public static void main(String[] args) {
SpringApplication.run(KafkaBootApplication.class, args);
}
}
一路run
public static ConfigurableApplicationContext run(Class<?> primarySource, String... args) {
return run(new Class<?>[] { primarySource }, args);
}
public static ConfigurableApplicationContext run(Class<?>[] primarySources, String[] args) {
return new SpringApplication(primarySources).run(args);
}
直到refreshContext(context)

private void refreshContext(ConfigurableApplica

本文探讨了SpringBoot中内嵌Tomcat的创建和启动流程。从启动类开始,经过refreshContext方法,调用AbstractApplicationContext的refresh,在ServletWebServerApplicationContext的onRefresh()中,使用模板方法设计模式。Tomcat在createWebServer()方法中被创建,然后通过initialize()方法启动,完成Tomcat的启动过程。
最低0.47元/天 解锁文章
1246

被折叠的 条评论
为什么被折叠?



