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方法上,然后往上翻代码即可。
  • 相关阅读:
    SqlServer2008启动不了的问题
    .exe 不包含适合入口点的静态“Main”方法
    两种常用的序列化
    异或运算^
    SqlServer数据库实现C#中的split功能
    遍历电脑下面所有文件--递归
    ExecuteNonQuery引发了System.ArgumentException类型异常
    JQuery属性过滤(转)
    SQL SERVER 执行远端数据库的SQL命令
    马云:做一个静静的观察者 能学到更多
  • 原文地址:https://www.cnblogs.com/javammc/p/12590155.html
Copyright © 2011-2022 走看看