spring boot 是如何启动 tomcat
Spring boot 的启动类启动后,tomcat 容器、Spring mvc 、spring 事务等等第三方依赖也已经自动启动,那么spring boot 是如何启动的第三方依赖?
以spring boot 为例:
1.进入spring boot 启动类,@SpringBootApplication 是Springboot 扫描第三方依赖的重要注解
进入@SpringBootApplication
再进入@EnableAutoConfiguration
使用@Import 对 AutoConfigurationImportSelector 类进行引入,首先调用 selectImport() 方法,再在方法中调用 getAutoConfigurationEntity()
再调用getCandidateConfigurations()
getCandidateConfigurations() 方法就去 META-INF/spring.factory 配置文件中加载相关的配置类
spring.factories 配置文件是加载 spring-boot-autoconfigure 的配置文件。
在spring.factories 文件中,找到加载 webservlet 的组件
打开改文件
通过工厂模式创建tomcat
最后是启动 tomcat
getWebServer 是谁调用启动的Tomcat?
打开 ServletWebServletApplicationContext
创建 tomcate 服务
选择 Tomcat
然后启动
参考:https://www.cnblogs.com/darendu/p/10559366.html
spring boot 是如何启动 tomcat的更多相关文章
- 200. Spring Boot JNDI:在Tomcat中怎么玩JNDI?
[视频&交流平台] àSpringBoot视频:http://t.cn/R3QepWG à SpringCloud视频:http://t.cn/R3QeRZc à Spring Boot源 ...
- 涨姿势:Spring Boot 2.x 启动全过程源码分析
目录 SpringApplication 实例 run 方法运行过程 总结 上篇<Spring Boot 2.x 启动全过程源码分析(一)入口类剖析>我们分析了 Spring Boot 入 ...
- Spring Boot 2.x 启动全过程源码分析
Spring Boot 2.x 启动全过程源码分析 SpringApplication 实例 run 方法运行过程 上面分析了 SpringApplication 实例对象构造方法初始化过程,下面继续 ...
- 【spring boot】spring cloud下spring boot微服务启动没有报错,但是访问访问不到
spring cloud下spring boot微服务启动没有报错,但是访问访问不到 解决方法: 可能是端口被占用了,但是依旧启用成功了. 更改一下项目启用的端口号,再重新启动查看是否可以正常访问.
- Spring Boot 内嵌容器 Tomcat / Undertow / Jetty 优雅停机实现
Spring Boot 内嵌容器 Tomcat / Undertow / Jetty 优雅停机实现 Anoyi 精讲JAVA 精讲JAVA 微信号 toooooooozi 功能介绍 讲解java深层次 ...
- Spring Boot项目指定启动后执行的操作
Spring Boot项目指定启动后执行的操作: (1)实现CommandLineRunner 接口 (2)重写run方法 (3)声明执行顺序@Order(1),数值越小,优先级越高 (4)如果需要注 ...
- Spring Boot 应用程序启动流程分析
SpringBoot 有两个关键元素: @SpringBootApplicationSpringApplication 以及 run() 方法 SpringApplication 这个类应该算是 Sp ...
- 多个Spring Boot项目部署在一个Tomcat容器无法启动
转自https://www.cnblogs.com/tomxin7/p/9434085.html 业务介绍 最近用Spring Boot开发了一个翻译的小项目,但是服务器上还跑着其他项目,包括一个同样 ...
- Spring Boot的快速启动和部署
>>关于Spring Boot 这是官网描述的特点: 1.Create stand-alone Spring applications 创建独立的Spring应用 2.Embed Tomc ...
随机推荐
- HttpClient与TestNG结合
1.HTTPclient插件的安装 在maven项目的pom.xml中引用HTTPclient包,如下 <dependencies> <dependency> <grou ...
- Aggregate 聚合用法
var listb= ListA.Where(x => x.Id.Equals(obj.Id)).Select(x => x.SubData).Aggregate((x, y) => ...
- 2020 i春秋新春战疫公益赛 misc
0x01 code_in_morse morse decode后得到: RFIE4RYNBINAUAAAAAGUSSCEKIAAAAEUAAAAA7AIAYAAAAEPFOMTWAAABANUSRCB ...
- web开发中的一些不常见的概念
1.惊群 [活跃]星际争霸小王子 就是当你在车站时,一堆拉客的人一拥而上,想你坐他的车,于是就惊群了.但你只能坐一个车,所以没拉到你的就悻悻而归,于是return false[活跃]星际争霸小王 2 ...
- Git储藏工作现场
假设你现在在dev分支工作,此时你接到一个修复一个代号101的bug的任务时,很自然地,你想创建一个分支issue-101来修复它,但是,等等,你当前工作只进行到一半,还没法提交,预计完成还需1天时间 ...
- contextField 键盘只允许输入数字和小数点,并且现在小数点后位数
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementS ...
- SSIS部署后执行失败,无法将保护的XML节点解密
将包属性中的 protectionLevel 设置成DontSaveSensitive 即可.
- java 日志的数据脱敏
思路 1.在 model层进行处理,直接重写get方法,在写一个getPlain 获取明文方法.(缺点:数据库写入和json序列化传递时使用的都是密文) 2.利用 日志组件过滤 特定的key,去进行脱 ...
- Codeforce 977E Cyclic Components
dfs判断图的连通块数量~ #include<cstdio> #include<algorithm> #include<vector> #include<cs ...
- 吴裕雄 python 神经网络——TensorFlow 自定义损失函数
import tensorflow as tf from numpy.random import RandomState batch_size = 8 x = tf.placeholder(tf.fl ...