SpringBoot启动原理详解
一,本篇来说说SpringBoot的启动原理 打开启动类,调试进入可以发现SpirngBoot的启动分为两部分: 1创建SpringApplication对象 2运行Run方法 public static ConfigurableApplicationContext run ( Class < ? > [ ] primarySources , String [ ] args ) { return ( new SpringApplication ( primarySources ) ) . run ( args ) ; } 先从创建对象讲起 public SpringApplication ( ResourceLoader resourceLoader , Class < ? > . . . primarySources ) { this . sources = new LinkedHashSet ( ) ; this . bannerMode = Mode . CONSOLE ; this . logStartupInfo = true ; this . addCommandLineProperties = true ; this . addConversionService = true ; this . headless = true ; this .