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方法上,然后往上翻代码即可。
  • 相关阅读:
    团队作业第五次——冲刺任务与计划
    2020-04-29 冲刺第一天
    OO Unit 2 Summary
    OO Unit 1 Summary
    团队项目-选题报告
    第一次结对编程作业
    第一次个人编程作业
    软件工程第一次作业
    软件工程2019第一次作业
    α阶段第九次会议
  • 原文地址:https://www.cnblogs.com/javammc/p/12590155.html
Copyright © 2011-2022 走看看