当前位置:网站首页>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

边栏推荐
- El upload Upload file (Manual upload, Automatic upload, upload progress)
- The same node code will cause duplicate data
- This connection is not a private connection this website may be pretending to steal your personal or financial information
- Fair lock and unfair lock
- Use of thread pool
- JS inheritance
- Break through the existing customer group marketing, and try customer grouping management (including clustering model and other practical effect evaluation)
- Blocking queue example
- 网络层详解
- Mongodb learning
猜你喜欢

FortiGate firewall and Aruze cloud tunnel interruption

How to use div boxes to simulate line triangles

Intern method of string

Share an example of a simple MapReduce method using a virtual machine

Learning about signals

Introduction to system programming

Issue SSL certificate with IP address

Transport layer protocol tcp/udp

FortiGate firewall quick initialization administrator password

File and IO
随机推荐
Websocket implementation principle
Share an example of a simple MapReduce method using a virtual machine
Myrpc version 0
487-3279(POJ1002)
01 backpack, dynamic planning
基于SSM框架茶叶商城系统【项目源码+数据库脚本+报告】
Use of thread pool
How to write a conditional statement to obtain the value of the maximum time in a table using a MySQL statement
FortiGate firewall modifies the default timeout of a session
Ora-00907: missing right parenthesis problem supplement
What is SQL injection and how to avoid it?
What is the difference between synchronized and lock
Refers to the difference between IP and *ip at output
Detailed explanation of data link layer
股票利益【非dp】
Serializable and Deserialize
How to use div boxes to simulate line triangles
Qt 6.3.1Conan软件包发布
Educoder group purchase suspension box page production
JS file block to Base64 text