创建SpringApplication阶段
- 保存当前主启动类信息
class com.atguigu.boot.Boot09HelloTestApplication
- 使用工具类ClassUtils判定当前应用的类型。一般是Servlet类型
- bootstrappers:初始启动引导器(List
):去spring.factories文件中找 org.springframework.boot.Bootstrapper - 找 ApplicationContextInitializer;去spring.factories找 ApplicationContextInitializer
- List
> initializers
- List
找 ApplicationListener ;应用监听器。去spring.factories找 ApplicationListener
StopWatch记录应用的启动时间
- 创建引导上下文(Context环境)createBootstrapContext()
- 获取到所有之前的 bootstrappers 挨个执行 intitialize() 来完成对引导启动器上下文环境设置
- 让当前应用进入headless模式。java.awt.headless
- 获取所有 RunListener(运行监听器)【为了方便所有Listener进行事件感知】
- getSpringFactoriesInstances 去spring.factories找 SpringApplicationRunListener.
- 遍历 SpringApplicationRunListener 调用 starting 方法;
- 相当于通知所有感兴趣系统正在启动过程的人,项目正在 starting。
- 保存命令行参数;ApplicationArguments
- 准备环境 prepareEnvironment();
- 返回或者创建基础环境信息对象。StandardServletEnvironment
- 读取所有的配置源的配置属性值。得到所有的PropertySources,@PropertySources即加载外部所有的配置文件xxx.properties
- 配置激活环境Profile信息,configureProfiles(environment, args);
- 监听器调用 listener.environmentPrepared();通知所有的监听器当前环境准备完成
- 创建IOC容器(createApplicationContext())
- 根据项目类型(Servlet)创建容器,
- 当前会创建 AnnotationConfigServletWebServerApplicationContext
- 准备ApplicationContext IOC容器的基本信息 prepareContext()
- 保存环境信息
- IOC容器的后置处理流程。
- 应用初始化器;applyInitializers;
- 遍历所有的 ApplicationContextInitializer 。调用 initialize.。来对ioc容器进行初始化扩展功能
- 遍历所有的 listener 调用 contextPrepared。EventPublishRunListenr;通知所有的监听器contextPrepared
- 所有的监听器 调用 contextLoaded。通知所有的监听器 contextLoaded;
- 刷新IOC容器。refreshContext【核心源码】
- 创建容器中的所有组件(Spring注解)
- 容器刷新完成后工作?afterRefresh
- 所有监听 器 调用 listeners.started(context); 通知所有的监听器 started
- 调用所有runners;callRunners()
- 获取容器中的ApplicationRunner
- 获取容器中的 CommandLineRunner
- 合并所有runner并且按照@Order进行排序
- 遍历所有的runner。先ApplicationRunner 后CommandLineRunner调用 run 方法
- 如果以上有异常,
- 调用Listener 的 failed
- 调用所有监听器的 running 方法 listeners.running(context); 通知所有的监听器 running
running如果有问题。继续通知 failed 。调用所有 Listener 的 failed;通知所有的监听器 failed
测试监控springboot启动的各个环节
以下黄颜色的5个组件就是我们要监控的组件:
ApplicationContextInitializer
- ApplicationListener
- SpringApplicationRunListener
- ApplicationRunner
- CommandLineRunner
其中需要注意MyApplicationContextInitializer、MyApplicationListener、MySpringApplicationRunListener这三个不需要加上加上@Component
,但需要配到自己的**spring.factories**
里面:配置成我们的对象
com.atguigu.boot.listener.MyApplicationContextInitializer
com.atguigu.boot.listener.MyApplicationListener
com.atguigu.boot.listener.MySpringApplicationRunListener
剩下两个MyApplicationRunner
和MyCommandLineRunner
不用配置到**spring.factories**
因为获取容器中的ApplicationRunner ,获取容器中的 CommandLineRunner
加上@Component,加上@Component即可
调用所有runners;callRunners() 获取容器中的ApplicationRunner 获取容器中的 CommandLineRunner 合并所有runner并且按照@Order进行排序 遍历所有的runner。先ApplicationRunner 后CommandLineRunner调用 run 方法
MyApplicationContextInitializer
package com.atguigu.boot.listener;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
public class MyApplicationContextInitializer implements ApplicationContextInitializer {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
System.out.println("MyApplicationContextInitializer ....initialize.... ");
}
}
MyApplicationListener
package com.atguigu.boot.listener;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
public class MyApplicationListener implements ApplicationListener {
@Override
public void onApplicationEvent(ApplicationEvent event) {
System.out.println("MyApplicationListener.....onApplicationEvent...");
}
}
MySpringApplicationRunListener
这些方法代表我们监听的Spring的一些操作状态
- 既能监听到做一些打印信息
- 也可以拿到具体状态阶段创建或者更新的对象(方法参数),这是个回调机制 ```java package com.atguigu.boot.listener;
import org.springframework.boot.ConfigurableBootstrapContext; import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplicationRunListener; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.ConfigurableEnvironment;
public class MySpringApplicationRunListener implements SpringApplicationRunListener {
private SpringApplication application;
public MySpringApplicationRunListener(SpringApplication application, String[] args){
this.application = application;
}
@Override
public void starting(ConfigurableBootstrapContext bootstrapContext) {
System.out.println("MySpringApplicationRunListener....starting....");
}
@Override
public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
System.out.println("MySpringApplicationRunListener....environmentPrepared....");
}
@Override
public void contextPrepared(ConfigurableApplicationContext context) {
System.out.println("MySpringApplicationRunListener....contextPrepared....");
}
@Override
public void contextLoaded(ConfigurableApplicationContext context) {
System.out.println("MySpringApplicationRunListener....contextLoaded....");
}
@Override
public void started(ConfigurableApplicationContext context) {
System.out.println("MySpringApplicationRunListener....started....");
}
@Override
public void running(ConfigurableApplicationContext context) {
System.out.println("MySpringApplicationRunListener....running....");
}
@Override
public void failed(ConfigurableApplicationContext context, Throwable exception) {
System.out.println("MySpringApplicationRunListener....failed....");
}
}
注意:若不写构造方法会报错,报错信息如下:
```java
D:\java8u211\jdk\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:D:\Program Files\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=62689:D:\Program Files\IntelliJ IDEA 2020.3.1\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\java8u211\jdk\jre\lib\charsets.jar;D:\java8u211\jdk\jre\lib\deploy.jar;D:\java8u211\jdk\jre\lib\ext\access-bridge-64.jar;D:\java8u211\jdk\jre\lib\ext\cldrdata.jar;D:\java8u211\jdk\jre\lib\ext\dnsns.jar;D:\java8u211\jdk\jre\lib\ext\jaccess.jar;D:\java8u211\jdk\jre\lib\ext\jfxrt.jar;D:\java8u211\jdk\jre\lib\ext\localedata.jar;D:\java8u211\jdk\jre\lib\ext\nashorn.jar;D:\java8u211\jdk\jre\lib\ext\sunec.jar;D:\java8u211\jdk\jre\lib\ext\sunjce_provider.jar;D:\java8u211\jdk\jre\lib\ext\sunmscapi.jar;D:\java8u211\jdk\jre\lib\ext\sunpkcs11.jar;D:\java8u211\jdk\jre\lib\ext\zipfs.jar;D:\java8u211\jdk\jre\lib\javaws.jar;D:\java8u211\jdk\jre\lib\jce.jar;D:\java8u211\jdk\jre\lib\jfr.jar;D:\java8u211\jdk\jre\lib\jfxswt.jar;D:\java8u211\jdk\jre\lib\jsse.jar;D:\java8u211\jdk\jre\lib\management-agent.jar;D:\java8u211\jdk\jre\lib\plugin.jar;D:\java8u211\jdk\jre\lib\resources.jar;D:\java8u211\jdk\jre\lib\rt.jar;E:\开发教程\springboot2\boot-09-hello-test\target\classes;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-web\2.4.0\spring-boot-starter-web-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter\2.4.0\spring-boot-starter-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot\2.4.0\spring-boot-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-autoconfigure\2.4.0\spring-boot-autoconfigure-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-logging\2.4.0\spring-boot-starter-logging-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-json\2.4.0\spring-boot-starter-json-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\core\jackson-databind\2.11.3\jackson-databind-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\core\jackson-annotations\2.11.3\jackson-annotations-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\core\jackson-core\2.11.3\jackson-core-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.3\jackson-datatype-jdk8-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.3\jackson-datatype-jsr310-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.3\jackson-module-parameter-names-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-tomcat\2.4.0\spring-boot-starter-tomcat-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\tomcat\embed\tomcat-embed-core\9.0.39\tomcat-embed-core-9.0.39.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.39\tomcat-embed-websocket-9.0.39.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-web\5.3.1\spring-web-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-beans\5.3.1\spring-beans-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-webmvc\5.3.1\spring-webmvc-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-aop\5.3.1\spring-aop-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-context\5.3.1\spring-context-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-expression\5.3.1\spring-expression-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-core\5.3.1\spring-core-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-jcl\5.3.1\spring-jcl-5.3.1.jar;E:\开发教程\springboot2\boot-09-customer-starter\atguigu-hello-spring-boot-starter-autoconfigure\target\classes com.atguigu.boot.Boot09HelloTestApplication
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.boot.SpringApplicationRunListener : com.atguigu.boot.listener.MySpringApplicationRunListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:467)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:449)
at org.springframework.boot.SpringApplication.getRunListeners(SpringApplication.java:437)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
at com.atguigu.boot.Boot09HelloTestApplication.main(Boot09HelloTestApplication.java:10)
Caused by: java.lang.NoSuchMethodException: com.atguigu.boot.listener.MySpringApplicationRunListener.<init>(org.springframework.boot.SpringApplication, [Ljava.lang.String;)
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getDeclaredConstructor(Class.java:2178)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:462)
... 6 more
Process finished with exit code 1
我们看看官方的spring.factories
的SpringApplicationRunListener
是怎么写的
搜一下EventPublishingRunListener
发现EventPublishingRunListener
写了有参构造器,所以我们模仿EventPublishingRunListener
给我们的MySpringApplicationRunListener
也添加有参构造器
//这也指示我们SpringApplicationRunListener会在初始化的时候拿到SpringApplication对象实例
private SpringApplication application;
public MySpringApplicationRunListener(SpringApplication application, String[] args){
this.application = application;
}
MyApplicationRunner
package com.atguigu.boot.listener;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Order(1)
@Component
public class MyApplicationRunner implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("MyApplicationRunner...run...");
}
}
MyCommandLineRunner
package com.atguigu.boot.listener;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 应用启动做一个一次性事情
*/
@Order(2)
@Component
public class MyCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
System.out.println("MyCommandLineRunner....run....");
}
}
跑起来看看
D:\java8u211\jdk\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:D:\Program Files\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=62824:D:\Program Files\IntelliJ IDEA 2020.3.1\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath D:\java8u211\jdk\jre\lib\charsets.jar;D:\java8u211\jdk\jre\lib\deploy.jar;D:\java8u211\jdk\jre\lib\ext\access-bridge-64.jar;D:\java8u211\jdk\jre\lib\ext\cldrdata.jar;D:\java8u211\jdk\jre\lib\ext\dnsns.jar;D:\java8u211\jdk\jre\lib\ext\jaccess.jar;D:\java8u211\jdk\jre\lib\ext\jfxrt.jar;D:\java8u211\jdk\jre\lib\ext\localedata.jar;D:\java8u211\jdk\jre\lib\ext\nashorn.jar;D:\java8u211\jdk\jre\lib\ext\sunec.jar;D:\java8u211\jdk\jre\lib\ext\sunjce_provider.jar;D:\java8u211\jdk\jre\lib\ext\sunmscapi.jar;D:\java8u211\jdk\jre\lib\ext\sunpkcs11.jar;D:\java8u211\jdk\jre\lib\ext\zipfs.jar;D:\java8u211\jdk\jre\lib\javaws.jar;D:\java8u211\jdk\jre\lib\jce.jar;D:\java8u211\jdk\jre\lib\jfr.jar;D:\java8u211\jdk\jre\lib\jfxswt.jar;D:\java8u211\jdk\jre\lib\jsse.jar;D:\java8u211\jdk\jre\lib\management-agent.jar;D:\java8u211\jdk\jre\lib\plugin.jar;D:\java8u211\jdk\jre\lib\resources.jar;D:\java8u211\jdk\jre\lib\rt.jar;E:\开发教程\springboot2\boot-09-hello-test\target\classes;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-web\2.4.0\spring-boot-starter-web-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter\2.4.0\spring-boot-starter-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot\2.4.0\spring-boot-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-autoconfigure\2.4.0\spring-boot-autoconfigure-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-logging\2.4.0\spring-boot-starter-logging-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-json\2.4.0\spring-boot-starter-json-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\core\jackson-databind\2.11.3\jackson-databind-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\core\jackson-annotations\2.11.3\jackson-annotations-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\core\jackson-core\2.11.3\jackson-core-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.3\jackson-datatype-jdk8-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.3\jackson-datatype-jsr310-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.3\jackson-module-parameter-names-2.11.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\boot\spring-boot-starter-tomcat\2.4.0\spring-boot-starter-tomcat-2.4.0.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\tomcat\embed\tomcat-embed-core\9.0.39\tomcat-embed-core-9.0.39.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.39\tomcat-embed-websocket-9.0.39.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-web\5.3.1\spring-web-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-beans\5.3.1\spring-beans-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-webmvc\5.3.1\spring-webmvc-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-aop\5.3.1\spring-aop-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-context\5.3.1\spring-context-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-expression\5.3.1\spring-expression-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-core\5.3.1\spring-core-5.3.1.jar;E:\dev_dir_temp\apache-maven-3.3.9\respository\org\springframework\spring-jcl\5.3.1\spring-jcl-5.3.1.jar;E:\开发教程\springboot2\boot-09-customer-starter\atguigu-hello-spring-boot-starter-autoconfigure\target\classes com.atguigu.boot.Boot09HelloTestApplication
MyApplicationListener.....onApplicationEvent...
MySpringApplicationRunListener....starting....
MyApplicationListener.....onApplicationEvent...
MySpringApplicationRunListener....environmentPrepared....
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.0)
MyApplicationContextInitializer ....initialize....
MyApplicationListener.....onApplicationEvent...
MySpringApplicationRunListener....contextPrepared....
2022-05-10 23:17:49.947 INFO 6336 --- [ main] c.a.boot.Boot09HelloTestApplication : Starting Boot09HelloTestApplication using Java 1.8.0_211 on DESKTOP-7OVMAA2 with PID 6336 (E:\开发教程\springboot2\boot-09-hello-test\target\classes started by hasee in E:\开发教程\springboot2)
2022-05-10 23:17:49.950 INFO 6336 --- [ main] c.a.boot.Boot09HelloTestApplication : No active profile set, falling back to default profiles: default
MyApplicationListener.....onApplicationEvent...
MySpringApplicationRunListener....contextLoaded....
2022-05-10 23:17:50.473 INFO 6336 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-05-10 23:17:50.479 INFO 6336 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-05-10 23:17:50.479 INFO 6336 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2022-05-10 23:17:50.528 INFO 6336 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-05-10 23:17:50.528 INFO 6336 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 544 ms
2022-05-10 23:17:50.635 INFO 6336 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2022-05-10 23:17:50.746 INFO 6336 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
MyApplicationListener.....onApplicationEvent...
MyApplicationListener.....onApplicationEvent...
2022-05-10 23:17:50.753 INFO 6336 --- [ main] c.a.boot.Boot09HelloTestApplication : Started Boot09HelloTestApplication in 1.041 seconds (JVM running for 1.879)
MyApplicationListener.....onApplicationEvent...
MyApplicationListener.....onApplicationEvent...
MySpringApplicationRunListener....started....
MyApplicationRunner...run...
MyCommandLineRunner....run....
MyApplicationListener.....onApplicationEvent...
MyApplicationListener.....onApplicationEvent...
MySpringApplicationRunListener....running....