SpringBoot版本:2.1.1 ==》启动流程分析汇总
接上篇博客Spring Boot 2.1.1(十)启动流程分析之ApplicationEnvironmentPreparedEvent事件发布。
目录
public ConfigurableApplicationContext run(String... args) {
....
try {
//本篇内容从本行开始记录
//得到系统属性spring.beaninfo.ignore,如果为空设置为true
configureIgnoreBeanInfo(environment);
//打印banner图
Banner printedBanner = printBanner(environment);
//本篇内容记录到这,后续更新
....
}
catch (Throwable ex) {
handleRunFailure(context, ex, exceptionReporters, listeners);
throw new IllegalStateException(ex);
}
}
流程分析
1、设置spring.beaninfo.ignore属性
至于该属性的作用是什么,暂时还不知道。
private void configureIgnoreBeanInfo(ConfigurableEnvironment environment) {
//得到系统属性spring.beaninfo.ignore,如果为空设置为true
if (System.getProperty(
CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME) == null) {
Boolean ignore = environment.getProperty("spring.beaninfo.ignore",
Boolean.class, Boolean.TRUE);
System.setProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME,
ignore.toString());
}
}