Spring boot内嵌服务器tomcat的启动过程
开始org.springframework.boot.SpringApplication#run(java.lang.Class<?>, java.lang.String...)
org.springframework.boot.SpringApplication#createApplicationContext
-
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext
-
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext
-
org.springframework.boot.SpringApplication#refreshContext
-
org.springframework.boot.SpringApplication#refreshContext
-
org.springframework.boot.SpringApplication#refresh
-
org.springframework.context.support.AbstractApplicationContext#refresh
-
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext#refresh
-
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext#onRefresh
→createWebServer创建内嵌的tomcat web服务器
-
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext#finishRefresh
启动服务器org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext#startWebServer
发布事件
org.springframework.boot.web.servlet.context.ServletWebServerInitializedEvent#ServletWebServerInitializedEvent 主要用来获得本地端口
增加 server.ports 属性源