1、容器初始化
protected void prepareRefresh() {
// Switch to active.
this.startupDate = System.currentTimeMillis();
this.closed.set(false);
//设置上下文状态
this.active.set(true);
// Initialize any placeholder property sources in the context environment.
// propertySources主要用来存储propertySource,并保存propertySource的解析器,对propertySources进行解析。
//初始化propertySources、因为采用注解的方式启动的,为空实现。
//如果采用其他的方式,例如:GenericWebApplicationContext在启动中,并且会初始化ServletConfig和servletContext。
initPropertySources();
// Validate that all properties marked as required are resolvable:
// see ConfigurablePropertyResolver#setRequiredProperties
// 校验必须的一些属性
getEnvironment().validateRequiredProperties();
//合并ApplicationListeners
// Store pre-refresh ApplicationListeners...
if (this.earlyApplicationListeners == null) {
this.earlyApplicationListeners = new LinkedHashSet<>(this.applicationListe