Bean creation process
- The key point analysis by the timing of the beginning, we knew Bean create sub-process entry
AbstractApplicationContext#refresh()
methodfinishBeanFactoryInitialization(beanFactory)
at
- enter
finishBeanFactoryInitialization
- Continue to enter
DefaultListableBeanFactory
the preInstantiateSingletons method of the class , we find the following part of the code, see the factory Bean or ordinary Bean , and finallygetBean
get the instance through the method
- Continuing to track down, we have entered
AbstractBeanFactory
the doGetBean method of the class. There are a lot of codes in this method, and we directly find the core part
- Then enter
AbstractAutowireCapableBeanFactory
the method of the class, find the following code part
- Enter the doCreateBean method to see, this method we focus on two key areas
- Create a Bean instance, the properties have not been set at this time
- Fill the Bean with attributes, call the initialization method, and apply the
BeanPostProcessor
post processor
This article references "Spring Advanced Source Notes", students who need to add assistant VX: C18173184271 free access
If you need this full version of "Spring Advanced Source Notes", you only need to support my article.
A lot of support, you can get information for free-after three consecutive years (promise: 100% free)
Quick start channel: Add assistant VX: C18173184271 Get it for free! Full of sincerity! ! !
Spring interview feature article click here! ! !