参考源
《Spring源码深度解析(第2版)》
版本
本文章基于 Spring 5.3.15
Spring IOC 的核心是
其中一共有 13 个主要方法,这里分析第 9 个:AbstractApplicationContext
的refresh
方法。onRefresh
。
1 AbstractApplicationContext
1-1 特定刷新
onRefresh()
protected void onRefresh() throws BeansException { }
这里为空,留给子类扩展。
可以重写以添加特定的刷新方法,在单例实例化之前调用特殊 bean 的初始化。