nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial
启动配置原理几个重要的事件回调机制
ApplicationContextInitializer
SpringApplicationRunListener
ApplicationRunner
CommandLineRunner
启动流程1return new SpringApplication(primarySources).run(args);
创建SpringApplication对象
运行run方法
创建对象现在左边的参数是null
123456789101112public SpringApplication(Class<?>... primarySources) { this(null, primarySources);}public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) { this.resourceLoader = resourceLoader; Assert.notNull(primarySources, "PrimarySources must not be null"); this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources)); this.webApplicationType = WebApplicationType.deduceFromClasspath(); setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class)); setListeners((Collection) getSpringFactoriesInstances(ApplicationListener.class)); this.mainApplicationClass = deduceMainApplicationClass();}
阅读全文…