@Override
public void refresh() throws BeansException, IllegalStateException {
synchronized (this.startupShutdownMonitor) {
// Prepare this context for refreshing.
prepareRefresh(); // Tell the subclass to refresh the internal bean factory.
ConfigurableListableBeanFactory beanFactory = obtainFreshBeanFactory(); // Prepare the bean factory for use in this context.
prepareBeanFactory(beanFactory); try {
// Allows post-processing of the bean factory in context subclasses.
postProcessBeanFactory(beanFactory); // Invoke factory processors registered as beans in the context.
invokeBeanFactoryPostProcessors(beanFactory); // Register bean processors that intercept bean creation.
registerBeanPostProcessors(beanFactory); // Initialize message source for this context.
initMessageSource(); // Initialize event multicaster for this context.
initApplicationEventMulticaster(); // Initialize other special beans in specific context subclasses.
onRefresh(); // Check for listener beans and register them.
registerListeners(); // Instantiate all remaining (non-lazy-init) singletons.
finishBeanFactoryInitialization(beanFactory); // Last step: publish corresponding event.
finishRefresh();
} catch (BeansException ex) {
if (logger.isWarnEnabled()) {
logger.warn("Exception encountered during context initialization - " +
"cancelling refresh attempt: " + ex);
} // Destroy already created singletons to avoid dangling resources.
destroyBeans(); // Reset 'active' flag.
cancelRefresh(ex); // Propagate exception to caller.
throw ex;
} finally {
// Reset common introspection caches in Spring's core, since we
// might not ever need metadata for singleton beans anymore...
resetCommonCaches();
}
}
}

包括BeanDefinition的Resource定位,载入,注册三个基本过程

三个过程分开,并使用不同的模块来完成,如何使用相应的ResourceLoader,BeanDefinitionReader等模块,通过这样的设计方式,可以让用户更加啊灵活的对这三个过程进行剪裁或扩展

Spring beanDefinition载入的更多相关文章

  1. Spring PropertyPlaceholderConfigure 载入配置文件

    在開始这篇博客的主题之前,我们先来了解一下Spring配置文件以及包括的相关内容. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2 ...

  2. 70.打印所有Spring boot载入的bean【从零开始学Spring Boot】

    [从零开始学习Spirng Boot-常见异常汇总] 问题的提出: 我们在开发过程当中,我们可能会碰到这样的问题:No qualifying bean  就是我们定义的bean无法进行注入,那到底是什 ...

  3. Spring BeanDefinition的加载

     前面提到AbstractRefreshableApplicationContext在刷新BeanFactory时,会调用loadBeanDefinitions方法以加载系统中Bean的定义,下面将讲 ...

  4. 扯淡 Spring BeanDefinition

    相关文章 Spring 整体架构 编译Spring5.2.0源码 Spring-资源加载 Spring 容器的初始化 Spring-AliasRegistry Spring 获取单例流程(一) Spr ...

  5. Spring BeanDefinition

    定义 /** * A BeanDefinition describes a bean instance, which has property values, * constructor argume ...

  6. spring BeanDefinition 继承结构图

    ConfigurationClassBeanDefinition 是ConfigurationClassBeanDefinitionReader的静态内部类

  7. BeanDefinition的载入和解析

    1.在完成对代表BeanDefinition的Resource定位的分析后,下面来了解整个BeanDefinition信息的载入过程. 2.对IoC容器来说,这个载入过程,相当于把定义的BeanDef ...

  8. 深入理解Spring系列之四:BeanDefinition装载前奏曲

    转载 https://mp.weixin.qq.com/s?__biz=MzI0NjUxNTY5Nw==&mid=2247483835&idx=1&sn=276911368d4 ...

  9. spring(四):IoC初始化流程&BeanDefinition加载注册

    ApplicationContext context = new ClassPathXmlApplicationContext("hello.xml"); /** * * @par ...

随机推荐

  1. 4G DTU和4G工业路由器有哪些区别?

    DTU的英文全称是Data Transfer unit,是一种专门用来将将IP数据转换为串口数据或者是将串口数据转换为IP数据并且通过无线通信网络将数据进行传送的无线终端设备.DTU也可以实现无线网络 ...

  2. OpenCascade拓扑对象之:TopoDS_Shape对象及其子对象

    @font-face { font-family: "Times New Roman" } @font-face { font-family: "宋体" } @ ...

  3. UbuntuStudio20.04安装教程(双系统安装,windows10已安装)

    硬件和系统: acer4750(原i3换i7,加固态硬盘200多G,原机械硬盘500G由光驱改装,内存由2G增加为6G)2010年购买3300,性价比高,硬件升级后2020年不过时 windows10 ...

  4. [Luogu P1066] 2^k进制数 (组合数或DP)

    题面 传送门:https://www.luogu.org/problemnew/show/P1066 Solution 这是一道神奇的题目,我们有两种方法来处理这个问题,一种是DP,一种是组合数. 这 ...

  5. C# 8: 可变结构体中的只读实例成员

    在之前的文章中我们介绍了 C# 中的 只读结构体(readonly struct)[1] 和与其紧密相关的 in 参数[2]. 今天我们来讨论一下从 C# 8 开始引入的一个特性:可变结构体中的只读实 ...

  6. mvc SelectList 给下拉框 @Html.DropDownList绑定值

    后台代码: public class DropController : Controller { // GET: Drop public ActionResult Index() { List< ...

  7. 19Jinja2中宏定义

    1 @app.route('/') 2 def hello_world(): 3 return render_template('index.html') 4 5 6 {% macro input(n ...

  8. Makefile 指定源文件目录 make

    top=$(CURDIR) SRC_DIR=$(top)/src BUILD_DIR=$(SRC_DIR) src=$(wildcard $(SRC_DIR)/*.c) obj=$(patsubst ...

  9. linux之NTP服务

    1. NTP服务(网络时间协议) Network Time Protocol(NTP)是用来使计算机时间同步化的一种协议,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒) ...

  10. “三剑客”之sed手中有剑

    一.sed介绍 sed是Stream Editor(字符流编辑器)的缩写,简称流编辑器.sed是操作.过滤和转换文本内容的强大工具.常用功能包括对文件实现快速增删改查(增加.删除.修改.查询),其中查 ...