Spring beanDefinition载入
2024-09-03 10:02:00
@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等模块,通过这样的设计方式,可以让用户更加啊灵活的对这三个过程进行剪裁或扩展
最新文章
- JavaScript自定义浏览器滚动条兼容IE、 火狐和chrome
- Linux基础介绍【第五篇】
- 从零开始学 Java - Spring 支持 CORS 请求踩的坑
- hadoop yarn running beyond physical memory used
- ·string和date转化以及数据库时间比较
- linq学习笔记:将List<;T>; 转换为 Dictionary<;T Key,T Value>;
- 【开源框架】Android之史上最全最简单最有用的第三方开源库收集整理,有助于快速开发,欢迎各位网友补充完善
- php 链接中加参数传递
- Hexo+NextT第三方服务调用【4】
- 结构-行为-样式-angularJs ngAnimate(Js实现)
- JAVA基础-抽象类
- 视觉SLAM
- webapi 使用Autofac 开发经历
- Azure Pipelines-部署代理问题
- HDU 6495 冰水挑战
- Qt中信号(signal)和槽(slot)的几种关联方法
- UITabView使用详解
- jquery 加載
- mysql----------阿里云RDS导入导出
- VBA 代码
热门文章
- 在阿里云Ubuntu 14.04.5 LTS下安装nethogs0.8.5
- POI CellStyle 中样式覆盖问题
- 深入了解Redis(8)-高可用方案
- sqlsugar入门(3)-DateTime.ToString(";yyyy-MM-dd HH:mm:ss.fff";)源码修改
- Spark: JAVA_HOME is not set
- mysql 一主多从环境搭建(亲测)
- HashMap的put kv,是如何扩容的?
- R语言factor类型转numeric
- 痞子衡嵌入式:RT-UFL - 一个适用全平台i.MXRT的超级下载算法设计
- 写博客真的很枯燥,更麻烦的是我还不会MD,排版太不友好了啊。