Spring源码追踪2——xml解析入口
2014-12-04 14:10
405 查看
解析xml节点入口
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(Element root)
继续往下追踪,parseCustomElement是解析自定义的元素节点,如<aop:aspectj-autoproxy />
自定义标签对应类查找
classpath下面的/META-INF/spring.handlers属性文件
(见:/article/3507860.html)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(Element root)
protected void doRegisterBeanDefinitions(Element root) { // Any nested <beans> elements will cause recursion in this method. In // order to propagate and preserve <beans> default-* attributes correctly, // keep track of the current (parent) delegate, which may be null. Create // the new (child) delegate with a reference to the parent for fallback purposes, // then ultimately reset this.delegate back to its original (parent) reference. // this behavior emulates a stack of delegates without actually necessitating one. BeanDefinitionParserDelegate parent = this.delegate; this.delegate = createDelegate(this.readerContext, root, parent); if (this.delegate.isDefaultNamespace(root)) { String profileSpec = root.getAttribute(PROFILE_ATTRIBUTE); if (StringUtils.hasText(profileSpec)) { Assert.state(this.environment != null, "Environment must be set for evaluating profiles"); String[] specifiedProfiles = StringUtils.tokenizeToStringArray( profileSpec, BeanDefinitionParserDelegate.MULTI_VALUE_ATTRIBUTE_DELIMITERS); if (!this.environment.acceptsProfiles(specifiedProfiles)) { return; } } } preProcessXml(root); parseBeanDefinitions(root, this.delegate); postProcessXml(root); this.delegate = parent; }
继续往下追踪,parseCustomElement是解析自定义的元素节点,如<aop:aspectj-autoproxy />
自定义标签对应类查找
classpath下面的/META-INF/spring.handlers属性文件
(见:/article/3507860.html)
相关文章推荐
- Spring源码浅析 -- XML配置文件的载入与解析
- Spring3.2 中 Bean 定义之基于 XML 配置方式的源码解析
- spring源码-2-xml标签的解析
- Spring源码分析2 — XML配置文件的解析流程
- spring源码解析-从xml配置文件中获取bean
- Spring的Autowired自动装配(XML版本+Annotation版本+源码+解析)
- Spring源码学习-容器初始化之FileSystemXmlApplicationContext(二)路径格式及解析方式(上) 推荐
- spring、mybatis加载xml源码解析
- 源码跟读,Spring是如何解析和加载xml中配置的beans
- Spring源码解读之Xml解析Annotation解析
- Spring 3.2 源码解析 -- XML bean 元素到 BeanDefinition 解析过程
- 解析Spring源码(2)---new XmlBeanFactory(new ClassPathResource("..."))
- spring IOC源码之解析xml中各个元素的过程
- spring 源码研究---bean包-- xml解析成bean对象
- Spring源码学习--Spring配置解析文件ApplicationContext.xml(一)
- Spring3.2 中 Bean 定义之基于 XML 配置方式的源码解析
- 解析Spring源码(1)--ClassPathResource("xxx.xml");
- Spring IOC 源码-ClassPathXmlApplicationContext-bean解析
- Spring Ioc 源码分析(一)- XML 解析
- 6.2 dubbo在spring中自定义xml标签源码解析