springboot
那年的夏天123
静下心来
展开
-
tomcat启动源码TomcatServletWebServerFactory之getWebServer方法解读
在springboot应用中默认的web容器实现就是tomcat。在ServletWebServerApplicationContext中的onRefresh方法调用createWebServer方法,再从spring容器中找到TomcatServletWebServerFactory,调用他的getWebServer,时序图如下:下面终点看getWebServer()方法:首先要理解一个类的作用:Connector:负责以某一种协议来接受连接请求。Server:代表一个端口的web服务Se原创 2021-03-19 21:40:13 · 5094 阅读 · 1 评论 -
springboot启动源码之SpringApplication的run方法一
先贴run方法源码:public ConfigurableApplicationContext run(String... args) { StopWatch stopWatch = new StopWatch(); stopWatch.start(); ConfigurableApplicationContext context = null; Collection<SpringBootExceptionReporter> exceptionReporters = new A原创 2021-02-16 09:31:35 · 325 阅读 · 1 评论 -
springboot启动源码之SpringApplication
这是SpringApplicaion的构造方法1.根据classpath选定WebApplicationType2.实例化Initializers3.实例化Listener public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) { this.resourceLoader = resourceLoader; Assert.notNull(primarySources,原创 2021-02-13 10:03:40 · 371 阅读 · 2 评论