spring IOC 核心流程分析
1、IOC 核心接口 IOC 中最主要的有两个接口,一个是BeanFactory ,一个是ApplicationContext 。 BeanFactory 作为IOC容器的顶层接口,提供了对容器bean 的一些基础操作如getBean(xxx),containsBean(xxx),isSingleton(String name),getType(String name)。 ApplicationContext 继承自BeanFactory接口,除了包含BeanFactory的所有功能之外,在国际化支持、资源访问(如URL和文件)、事件传播等方面进行了良好的支持。 2、IOC 核心流程 AbstractApplicationContext.refresh() @Override public void refresh() throws BeansException, IllegalStateException { synchronized (this.startupShutdownMonitor) { // Prepare this context for refreshing. prepareRefresh(); /* * 1、刷新子类BeanFactory * 2、创建Beanfactory实例 * beanFactory = new