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

非懒加载的单例bean的概念 #4

Open
Thw841277862 opened this issue Oct 16, 2023 · 1 comment
Open

非懒加载的单例bean的概念 #4

Thw841277862 opened this issue Oct 16, 2023 · 1 comment
Labels
question Further information is requested

Comments

@Thw841277862
Copy link

作者你好,你在BeanPostProcessor源码分析中,提到过一个'非懒加载的单例bean'的概念,我不太清楚这是什么意思。在Spring中,我知道有'懒加载'和'非懒加载'这两种方式,但我不太确定它们的具体作用和差异是什么。能否详细为我解释一下?

@xuchengsheng
Copy link
Owner

非懒加载会在应用启动时立即创建所有bean,而懒加载则会延迟bean的创建,直到这个Bean首次被请求。选择使用哪种方式取决于你的具体需求和你希望如何区分利弊,比如启动时间与运行时性能。

@xuchengsheng xuchengsheng added the question Further information is requested label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants