前言-阅读源码有利于陶冶情操,本文承接前文Spring源码情操陶冶-AbstractApplicationContext
约束:

  1. 本文指定contextClass为默认的XmlWebApplicationContext
  2. 从属AbstractApplicationContext#refresh方法

AbstractApplicationContext#prepareRefresh

代码清单如下

protected void prepareRefresh() {
		//设置刷新开始时间
		this.startupDate = System.currentTimeMillis();
		
		//设置ApplicationContext的激活状态为true
		synchronized (this.activeMonitor) {
			this.active = true;
		}

		if (logger.isInfoEnabled()) {
			logger.info("Refreshing " + this);
		}

		// Initialize any placeholder property sources in the context environment
		initPropertySources();

		// Validate that all properties marked as required are resolvable
		// see ConfigurablePropertyResolver#setRequiredProperties
		getEnvironment().validateRequiredProperties();
	}

如官方注释所示,上述预刷新方法主要是设置refresh操作的起始时间、active=true、并且初始化属性资源的校验(此处可忽略,无任何操作)

下节预告

Spring源码情操陶冶-AbstractApplicationContext#obtainFreshBeanFactory

相关文章:

  • 2021-09-20
  • 2021-11-18
  • 2021-10-11
  • 2021-05-20
  • 2021-09-28
  • 2021-07-27
  • 2021-08-26
  • 2021-12-05
猜你喜欢
  • 2021-11-13
  • 2021-05-19
  • 2021-12-24
  • 2021-05-28
  • 2021-09-12
  • 2021-07-02
  • 2021-06-11
相关资源
相似解决方案