1 Star 0 Fork 156

whl595145999 / Spring-Analysis

forked from huifer / Code-Analysis 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Spring-AbstractXmlApplicationContext.md 1.75 KB
一键复制 编辑 原始数据 按行查看 历史

Spring AbstractXmlApplicationContext

  • 类全路径: org.springframework.context.support.AbstractXmlApplicationContext

  • xml应用上下文

  • 关联类

方法分析

loadBeanDefinitions

  • 方法签名: org.springframework.context.support.AbstractXmlApplicationContext#loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory)

  • 方法作用: 创建XmlBeanDefinitionReader 读取beanDefintion

方法流程

  1. 创建 XmlBeanDefinitionReader
  2. 设置环境属性
  3. 初始化 XmlBeanDefinitionReader
  4. 进行资源加载
loadBeanDefinitions 方法详情
@Override
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOException {
   // 创建 读取 xml bean定义的类
   // Create a new XmlBeanDefinitionReader for the given BeanFactory.
   XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);

   // Configure the bean definition reader with this context's
   // resource loading environment.
   // 设置环境
   beanDefinitionReader.setEnvironment(this.getEnvironment());
   // 设置资源加载器
   beanDefinitionReader.setResourceLoader(this);
   // 资源解析器
   beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));

   // Allow a subclass to provide custom initialization of the reader,
   // then proceed with actually loading the bean definitions.
   // 初始化 bean定义阅读器
   initBeanDefinitionReader(beanDefinitionReader);
   // 加载 bean 定义
   loadBeanDefinitions(beanDefinitionReader);
}
Java
1
https://gitee.com/595145999/spring-analysis.git
git@gitee.com:595145999/spring-analysis.git
595145999
spring-analysis
Spring-Analysis
master

搜索帮助