spring parse xml document parsing source

Parse xml document in two forms: DOM and SAX parsing parsing, has been heard before spring xml parsing is DOM parsing, recently nothing to look at the spring source, to know a bit about the resolution process, to be a record.

spring of objects created by the factory is completed, the top-level interface is BeanFactory, now more commonly used is the ApplicationContext. The main difference is Beanfactory used only in specific objects are not created out, ApplicationContext configuration file is parsed at initialization spring container, and to create out all the objects.
Here to study a little ApplicationContext implementation class XmlApplicationContext configuration file parsing process. Classes and methods throughout the design process more, listed here simply call the procedure.

ClassPathXmlApplicationContext 构造方法
AbstractApplicationContext refresh()
获取工厂对象
AbstractApplicationContext obtainFreshBeanFactory()
AbstractRefreshableApplicationContext refreshBeanFactory()
加载配置文件(xml文件)
AbstractXmlApplicationContext loadBeanDefinitions(DefaultListableBeanFactory beanFactory)
AbstractXmlApplicationContext loadBeanDefinitions(XmlBeanDefinitionReader reader)
AbstractBeanDefinitionReader loadBeanDefinitions(String… locations)
AbstractBeanDefinitionReader loadBeanDefinitions(String location,Set actualResources)
AbstractBeanDefinitionReader loadBeanDefinitions(Resource… resources)
XmlBeanDefinitionReader loadBeanDefinitions (EncodedResource encodedResource)
reads the configuration file content in the form of flow
XmlBeanDefinitionReader doLoadDocument (InputSource inputSource, Resource Resource)
XmlBeanDefinitionReader doLoadBeanDefinitions (InputSource inputSource, Resource Resource)
began registering bean
XmlBeanDefinitionReader registerBeanDefinitions (the Document DOC, Resource Resource)
DefaultBeanDefinitionDocumentReader registerBeanDefinitions (the Document DOC , XmlReaderContext readerContext)
DefaultBeanDefinitionDocumentReader doRegisterBeanDefinitions (the Element the root)
parsing each specific instance of a bean and label content object
DefaultBeanDefinitionDocumentReaderparseBeanDefinitions (Element root, BeanDefinitionParserDelegate delegate)
DefaultBeanDefinitionDocumentReader parseDefaultElement (Element ele, BeanDefinitionParserDelegate delegate)
DefaultBeanDefinitionDocumentReader processBeanDefinition (Element ele, BeanDefinitionParserDelegate delegate)
BeanDefinitionParseDelegate parseBeanDefinitionElement (Element ele, @Nullable BeanDefinition containingBean)
BeanDefinitionParseDelegate parseBeanDefinitionElement (Element ele, String beanName, @Nullable BeanDefinition containingBean )

Released six original articles · won praise 0 · Views 127

Guess you like

Origin blog.csdn.net/li210530/article/details/95028862