zoukankan      html  css  js  c++  java
  • SpringBoot内置Tomcat启动的源码分析

    1. 完整启动debug流程如下:
    >SpringApplication.run(BootStudyApplication.class,args);
     	>org.springframework.boot.SpringApplication#run(java.lang.Class<?>[], java.lang.String[])
     		>org.springframework.boot.SpringApplication#refreshContext
     			>org.springframework.boot.SpringApplication#refresh
     				>org.springframework.context.support.AbstractApplicationContext#refresh
     					>org.springframework.context.support.AbstractApplicationContext#refresh
     						>org.springframework.context.support.AbstractApplicationContext#onRefresh
     							>org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext#createWebServer
     								>org.springframework.boot.web.servlet.server.ServletWebServerFactory#getWebServer
     									>org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory#getTomcatWebServer
     										>org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory#getTomcatWebServer
     											>org.springframework.boot.web.embedded.tomcat.TomcatWebServer#initialize
     												>org.springframework.boot.web.embedded.tomcat.TomcatWebServer#start
    

    描述:
    SpringBoot项目启动会调用Spring刷新容器方法,然后会调用到onRefresh方法,此方法是一个空方法,被子类ServletWebServerApplicationContext覆写,然后他会调用创建web容器的方法,然后创建出一个Tomcat,并且启动Tomcat。

    流程图如下:

    1. 有兴趣自己调试的小伙伴可以写一个SpringBoot项目,把断点打在TomcatWebServer的start方法上,然后往上翻代码即可。
  • 相关阅读:
    寒假学习进度七
    寒假学习进度六
    寒假学习进度五
    mysql 数据库第一天
    HTML 标签&总结
    事件对象
    js的事件流的概念
    jquery 的位置信息
    小米导航 案例
    jquery 的文档操作
  • 原文地址:https://www.cnblogs.com/javammc/p/12590155.html
Copyright © 2011-2022 走看看