SpringApplication:SpringBoot程序启动的一站式解决方案

深入探索SpringApplication执行流程

因为书上的版本是1.2的,比较老,这里参考http://blog.csdn.net/zxzzxzzxz123/article/details/69941910

public ConfigurableApplicationContext run(String... args) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ConfigurableApplicationContext context = null;
FailureAnalyzers analyzers = null;
configureHeadlessProperty();
SpringApplicationRunListeners listeners = getRunListeners(args);
listeners.starting();
try {
ApplicationArguments applicationArguments = new DefaultApplicationArguments(
args);
ConfigurableEnvironment environment = prepareEnvironment(listeners,
applicationArguments);
Banner printedBanner = printBanner(environment);
context = createApplicationContext();
analyzers = new FailureAnalyzers(context);
prepareContext(context, environment, listeners, applicationArguments,
printedBanner);
refreshContext(context);
afterRefresh(context, applicationArguments);
listeners.finished(context, null);
stopWatch.stop();
if (this.logStartupInfo) {
new StartupInfoLogger(this.mainApplicationClass)
.logStarted(getApplicationLog(), stopWatch);
}
return context;
}
catch (Throwable ex) {
handleRunFailure(context, listeners, analyzers, ex);
throw new IllegalStateException(ex);
}
}

SpringApplicationRunListener

SpringApplicationRunListener是一个只有SpringBoot应用的main方法执行过程中接收不同执行时点时间通知的监听者

ApplicationListener

ApplicationContextInitializer

CommandLineRunner

最新文章

  1. centos7优化内核参数详解
  2. firefox浏览器不支持复制粘贴(linux)
  3. Android UI性能优化实战, 识别View中的性能问题
  4. C#反射动态调用dll中的方法
  5. Java Socket 模拟HTTP请求
  6. iOS - UIView操作(SWift)
  7. Call to undefined function imagettftext()解决方法
  8. css(display,float,position)
  9. Apache Kylin
  10. PHP的魔术方法(简介)
  11. Linux系统安装VM-Tools
  12. 实现 $.extend 的深复制和浅复制
  13. Codeforces Round #429 (Div. 2) 补题
  14. SpringMVC基础-controller方法中的参数注解
  15. Gitpage + hexo(3.0以上)搭建博客
  16. vue slot+传参
  17. list练习
  18. spring-boot(八) springboot整合shiro-登录认证和权限管理
  19. day04列表
  20. Vue之项目搭建

热门文章

  1. 【BZOJ4435】[Cerc2015]Juice Junctions Tarjan+hash
  2. Swift 学习笔记 (枚举)
  3. python使用记录
  4. 近年来世界各地ICO的花式骗局盘点
  5. php微信支付测试开发(流程已通)
  6. ajax 异步 跨域上传图片
  7. STS、Eclipse报java.lang.OutOfMemoryError: PermGen space 内存溢出
  8. jQuery(expression, [context])
  9. 算法(Algorithms)第4版 练习 链表类 1.3.19~1.3.29
  10. hihocoder1075【开锁魔法】