spring boot中使用的是內建的tomcat,而不像spring mvc那樣依賴外部tomcat執行專案。
spring boot中匯入了tomcat的jar包:
檢視此方法的實現類:
檢視其實現類:
就是下面這段**:
@override其gettomcatwebserver方法:public
webserver getwebserver(servletcontextinitializer... initializers)
preparecontext(tomcat.gethost(), initializers);
return
gettomcatwebserver(tomcat);
}
上面啟動tomcat並設定守護執行緒。
springboot原始碼略讀
springboot的精髓是自動依賴注入。那麼哪些能自動注入呢,開啟spring boot autoconfigure,jar下的spring.factories。可以看到一堆這樣的配置 auto configure org.springframework.boot.autoconfigure.en...
SpringBoot原始碼分析
public class 第乙個引數 resourceloader 資源載入器 第二個引數 primarysources 載入的主要資源類 suppresswarnings public resourceloader resourceloader,class primarysources deduc...
Spring Boot 原始碼分析
1 專案初始化過程 springboot啟動類 springboot的啟動很簡單,如下 public static void main string args this.resourceloader resourceloader initialize sources private void ini...