头一日,johnson完成了一个spring的整体框架。
第二日,johnson准备实际去处理前面遗留的问题。比如spring的容器初始化过程。如图,johnson将这个过程分为很多子过程,这些子过程都在围绕着如何将bean载入这一宏伟的目标而努力。
这个过程放在AbstractApplicationContext中的refresh方法中。代码如下,johnson将refresh的过程分为很多子过程,并且这些子过程在同一个抽象层级上,这种写法是为了给后人一个榜样。
public void refresh() throws BeansException, IllegalStateException {
synchronized (this.startupShutdownMonitor) {
// Prepare this context for refreshing.
prepareRefresh();
// Tell the subclass to refresh the internal bean factory.
ConfigurableListableBeanFactory beanFactory = obtainFreshBeanFactory();
// Prepare the bean factory for use in this context.
prepareBeanFactory(beanFacto