zoukankan      html  css  js  c++  java
  • Spring源码情操陶冶-AbstractApplicationContext#prepareRefresh

    前言-阅读源码有利于陶冶情操,本文承接前文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

  • 相关阅读:
    PHP开发APP接口(三)
    PHP开发APP接口(二)
    PHP开发APP接口(一)
    解密PHP模糊查询技术
    流程的问题
    德邦项目《表》
    微信公众号开发1
    在world2013中插入GB_2312
    HTML5笔记(一)
    蓝色文字显示
  • 原文地址:https://www.cnblogs.com/question-sky/p/6703800.html
Copyright © 2011-2022 走看看