springboot启动过程图解,SpringBoot启动流程

首页 > 机动车 > 作者:YD1662023-11-09 18:32:06

然后通过 SpringApplicationRunListeners的构造器,把这个EventPublishingRunListener 赋值给了全局变量 listeners。

SpringApplicationRunListeners(Log log, Collection<? extends SpringApplicationRunListener> listeners, ApplicationStartup applicationStartup) { this.log = log; this.listeners = new ArrayList(listeners); this.applicationStartup = applicationStartup; }


listeners.starting(bootstrapContext, this.mainApplicationClass); 发布事件

springboot启动过程图解,SpringBoot启动流程(5)

根据事件找到匹配的监听器,执行。异步执行就丢到线程池中执行。同步的话就直接调用。

springboot启动过程图解,SpringBoot启动流程(6)

springboot启动过程图解,SpringBoot启动流程(7)


2:在SpringApplication.run方法中下一步:准备环境

ConfigurableEnvironment environment = this.prepareEnvironment(listeners, bootstrapContext, applicationArguments); 这里面又发布了一个环境准备的事件。

springboot启动过程图解,SpringBoot启动流程(8)

上一页1234下一页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.