当前位置:网站首页>Beanfactory creation process
Beanfactory creation process
2022-06-30 04:34:00 【Leisurely summer】
1、 obtain BeanFactory Sub process

2、BeanDefinition Load analysis and registration sub process
2.1、 This sub process involves the following key steps
Resource location : Pointing right BeanDefinition Resource location process . Generally speaking, it is to find the definition Javabean The information of XML file , And encapsulate it as Resource object .
BeanDefinition load : User defined Javabean Expressed as IoC The data structure inside the container , The data structure inside the container is BeanDefinition.
register BeanDefinition To IoC Containers
2.2、 process analysis
Step 1: Sub process entry AbstractRefreshableApplicationContext#refreshBeanFactory In the method
Step 2: Calling multiple classes in turn loadBeanDefinitions Method —> AbstractXmlApplicationContext —>
AbstractBeanDefinitionReader —> XmlBeanDefinitionReader Until XmlBeanDefinitionReader Of doLoadBeanDefinitions Method
Step 3: We focus on XmlBeanDefinitionReader Class registerBeanDefinitions Method , Multiple overloaded calls occurred during , Let's go to the last

Here we focus on two places :⼀ individual createRederContext Method ,⼀ Yes DefaultBeanDefinitionDocumentReader Class registerBeanDefinitions Method , Enter the first createRederContext Methods take a look at

We can see , here Spring ⾸ It's done first NamespaceHandlerResolver The initialization .
Let's go back to registerBeanDefinitions Method to track , Called DefaultBeanDefinitionDocumentReader#registerBeanDefinitions Method

Get into doRegisterBeanDefinitions Method

Get into parseBeanDefinitions Method

Get into parseDefaultElement Method

Get into processBeanDefinition Method

thus , End of registration process , We found that , The so-called registration is to encapsulate XML As defined in Bean The information is encapsulated as BeanDefinition Put after object ⼀ individual Map in ,BeanFactory In order to Map The structure of organizing these BeanDefinition Of .

Can be in DefaultListableBeanFactory See this in Map The definition of
/** Map of bean definition objects, keyed by bean name. */
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>(256);2.3、 Sequence diagram

边栏推荐
- 小C的数组(array)
- Iterator of JS
- Internship: interface case implementation
- Serializable and Deserialize
- iMile 利用 Zadig 多云环境周部署千次,跨云跨地域持续交付全球业务
- Intern method of string
- Memorize unfamiliar words at SSM stage and update them from time to time
- How to use div boxes to simulate line triangles
- Network high concurrency
- Summary of the reasons why transactional doesn't work
猜你喜欢

Myrpc version 6

A solution to the problem of "couldn't open file /mnt/repodata/repomd.xml"

How the FortiGate firewall rejects a port by using the local in policy policy

Myrpc version 0

Network high concurrency

输入输出及中断技术——微机第六章学习笔记

Interprocess communication

FortiGate configures multiple server IPS as link monitor monitoring objects on the same interface

管道实现进程间通信之命名管道

File and IO
随机推荐
Method of applying for code signing certificate by enterprise
Serializable and Deserialize
[FPGA] IIC读写EEPROM 的实现
FortiGate firewall and Aruze cloud tunnel interruption
管道实现进程间通信之命名管道
Qt Creator 8 Beta2发布
thinkphp5实现导入功能
Detailed explanation of network layer
Threejs实现模拟河流,水面水流,水管水流,海面
File and IO
Redis实现短信登入功能(一)传统的Session登入
Issue SSL certificate with IP address
OneNote software
FortiGate firewall quick initialization administrator password
Myrpc version 6
Bean创建流程 与 lazy-init 延迟加载机制原理
Window10 jar double click to run without response
什么是光耦电路,实际使用中应该注意些什么?
Es2019 key summary
SSL universal domain name certificate