NamespaceHandlerResolver
public NamespaceHandler resolver(String namespaceUri);
DefaultNamespaceHandlerResolver返回执行标签解析的 NamespaceHandler对象
DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver
default_handler_mappings_location = "META-INF/spring.handlers";
spring.handlers文件的配置使用的NamespaceHandler对象
http://www.springframework.org/schema/aop=cn.tk.***.aop.config.AopNamespaceHandler
AopNamespaceHandler extends NamespaceHandlerSupport
执行注册 BeanDefinitionParser 对象
public void init(){
registrerBeanDefinitionParser("config", new ConfigBeanDefinitionParser());
}
AOP标签的解析交给ConfigBeanDefinitionParser对象解析
ApplicationContext
ClassPathXmlApplicationContext --> AbstractXmlApplicationContext --> AbstratcRefreshableConfigApplicationContext -->
AbstractRefreshableApplicationContext --> AbstractApplicationContext
AbstractApplicationContext 中 refresh()方法
public void refresh() {
prepareRefresh();
获取BeanFactory
AutowireCapableBeanFactory beanFactory = obtainFreshBeanFactory();
执行 BeanFactoryPostProcessor 和 BeanDefinitionRegistryPostProcessor
registerBeanPostProcessors(beanFactory);
执行Bean的getBean()方法
finishBeanFactoryInitialization(beanFactory);
}