12、finishRefresh();完成BeanFactory的初始化创建工作;IOC容器就创建完成;
/**
* Finish the refresh of this context, invoking the LifecycleProcessor's
* onRefresh() method and publishing the
* {@link org.springframework.context.event.ContextRefreshedEvent}.
*/
protected void finishRefresh() {
// Initialize lifecycle processor for this context.
//初始化和生命周期有关的后置处理器;LifecycleProcessor
//默认从容器中找是否有lifecycleProcessor的组件【LifecycleProcessor】;
//如果没有new DefaultLifecycleProcessor();
initLifecycleProcessor();
// Propagate refresh to lifecycle processor first.
//拿到前面定义的生命周期处理器(BeanFactory);回调onRefresh();
getLifecycleProcessor().onRefresh();
// Publish the final event.
//发布容器刷新完成事件;
publishEvent(new ContextRefreshedEvent(this));
// Participate in LiveBeansView MBean, if active.
LiveBeansView.registerApplicationContext(this);
}