本文原文地址
百万架构师系列文章阅读体验感更佳
dispatcherServlet 图片
AbstractApplicationContext
//初始化所有剩余的单例Bean
// 当工厂初始化完成的时候,
finishBeanFactoryInitialization(beanFactory);
它在判断它是不是“延时加载”,如果不是“延时加载”才给它注入
DefaultListableBeanFactory
加载。
//对配置lazy-init属性单态Bean的预实例化
@Override
public void preInstantiateSingletons() throws BeansException {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Pre-instantiating singletons in " + this);
}
// Iterate over a copy to allow for init methods which in turn register new bean definitions.
// While this may not be part of the regular factory bootstrap, it does otherwise work fine.
List<String&g