当前位置:网站首页>When was the autowiredannotationbeanpostprocessor instantiated?
When was the autowiredannotationbeanpostprocessor instantiated?
2022-06-26 05:25:00 【Light dust ×】
AutowiredAnnotationBeanPostProcessor yes spring The cornerstone of automatic assembly , According to the foregoing 《 internalAutowiredAnnotationProcessor Where did it come from ?》, We already know that AutowiredAnnotationBeanPostProcessor When was it added BeanDefinition, In which step is it instantiated ?
Set the breakpoint at refresh() Methodical invokeBeanFactoryPostProcessors It's about

We can see invokeBeanFactoryPostProcessor Note on
/**
* Instantiate and invoke all registered BeanFactoryPostProcessor beans,
* respecting explicit order if given.
* <p>Must be called before singleton instantiation.
*/
I have just passed CET-4 : Instantiate and call all registered BeanFactoryPostProcessor, If the order is given , Come in order ~

Will there be instantiation here AutowiredAnnotationBeanPostProcessor Well ?
You can see , When the program runs ,beaDefinitionNames It contains org.springframework.context.annotation.internalAutowiredAnnotationProcessor Of

And the storage completes instantiation bean Of singletonObects There is no , in other words , up to now ,AutowiredAnnotationBeanPostProcessor Not yet instantiated

next step , perform invokeBeanFactoryPostProcessor, Look again singletonObects, You can see , It only includes ConfigurationClassPostProcessor、DefaultEventListenerFactory and EventListenerMethodProcessor Instantiate the object

What we care about AutowiredAnnotationBeanPostProcessor There is no instantiation , I think this is because it belongs to BeanPostProcessor This system , It doesn't belong to BeanFactoryPostProcessor System reasons

Carry on registerBeanPostProcessors(beanFactory), You can see it at the end ,AutowiredAnnotationBeanPostProcessor Instantiation is complete .

So you can locate ,AutowiredAnnotationBeanPostProcessor The instantiation of occurs in registerBeanPostProcessors(beanFactory) Inside
Follow in , The comments on the methods all look the same , The reality is totally different , about invokeBeanFactoryPostProcessor Is to instantiate and execute , And here is : Instantiate and register all BeanPostProcessor, in other words , The call doesn't happen here .
/**
* Instantiate and register all BeanPostProcessor beans,
* respecting explicit order if given.
* <p>Must be called before any instantiation of application beans.
*/
protected void registerBeanPostProcessors(ConfigurableListableBeanFactory beanFactory) {
PostProcessorRegistrationDelegate.registerBeanPostProcessors(beanFactory, this);
}
Why? ?
My understanding is that BeanFactoryPostProcessor The object of enhancement is BeanFactory, I.e. container , They need to be executed before and after the container creation process , Because the user-defined object will be created soon , Which is execution finishBeanFactoryInitialization(beanFactory), It will be too late to delay , and BeanPostProcessor The object of enhancement is bean object , It should be around bean Before the creation of 、 In the create 、 Create and then execute , To enhance bean The effect of , So here is just instantiation and registration , It's not implemented .
The process of instantiation is also the same as that of ordinary bean object , It's also getBean/doGetBean/createBean/doCreate/createBeanInstance That set , This will be analyzed in a separate context .

边栏推荐
- Thoughts triggered by the fact that app applications are installed on mobile phones and do not display icons
- apktool 工具使用文档
- Windows下安装Tp6.0框架,图文。Thinkphp6.0安装教程
- The parameter field of the callback address of the payment interface is "notify_url", and an error occurs after encoding and decoding the signed special character URL (,,,,,)
- [activity recommendation] cloud native, industrial Internet, low code, Web3, metauniverse... Which is the architecture hot spot in 2022
- cartographer_pose_graph_2d
- Redis installation on Linux
- Procedural life
- 红队得分方法统计
- Sentimentin tensorflow_ analysis_ cell
猜你喜欢

Apktool tool usage document

Baidu API map is not displayed in the middle, but in the upper left corner. What's the matter? Resolved!

【ARM】在NUC977上搭建基于boa的嵌入式web服务器

Tp5.0 framework PDO connection MySQL error: too many connections solution

国务院发文,完善身份认证、电子印章等应用,加强数字政府建设

Ad tutorial series | 4 - creating an integration library file

SDN based DDoS attack mitigation

慢慢学JVM之缓存行和伪共享

Second day of deep learning and tensorfow
A beginner's entry is enough: develop mobile IM from zero
随机推荐
The wechat team disclosed that the wechat interface is stuck with a super bug "15..." The context of
The localstorage browser stores locally to limit the number of forms submitted when tourists do not log in.
cartographer_ backend_ constraint
Tensorflow visualization tensorboard "no graph definition files were found." error
Experience of reading the road to wealth and freedom
无线网络存在的安全问题及现代化解决方案
First day of deep learning and tensorflow learning
cartographer_ fast_ correlative_ scan_ matcher_ 2D branch and bound rough matching
skimage.morphology.medial_axis
How does P2P technology reduce the bandwidth of live video by 75%?
【活动推荐】云原生、产业互联网、低代码、Web3、元宇宙……哪个是 2022 年架构热点?...
localStorage浏览器本地储存,解决游客不登录的情况下限制提交表单次数。
Yunqi lab recommends experience scenarios this week, free cloud learning
Tp5.0 framework PDO connection MySQL error: too many connections solution
cartographer_backend_constraint
Introduction to alluxio
Could not get unknown property ‘*‘ for SigningConfig container of type org.gradle.api.internal
[leetcode] 713: subarray with product less than k
LSTM in tensorflow_ Layers actual combat
基于SDN的DDoS攻击缓解