Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于getBean返回值的一个问题 #22

Open
gxhao opened this issue Aug 1, 2021 · 1 comment
Open

关于getBean返回值的一个问题 #22

gxhao opened this issue Aug 1, 2021 · 1 comment

Comments

@gxhao
Copy link

gxhao commented Aug 1, 2021

如题,在Application-context分支下的AbstractApplicationContext的refresh方法会创建beanFactory并加载bean的属性,之后再实例化bean时执行preInstantiateSingletons方法。
这个方法我有一点看不懂,beanDefinitionMap中已经有四个对象(person、car、customBeanFactoryPostProcessor、customerBeanPostProcessor)。之后再引用getBean方法返回DefaultListableBeanFactory的意义是什么?
QQ图片20210801171145

@DerekYRC
Copy link
Owner

此处执行getBean方法是为了提前初始化bean实例哈

@DerekYRC DerekYRC reopened this Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants