spring加载xml中的bean步骤

AbstractApplicationContext#refresh()

AbstractApplicationContext#obtainFreshBeanFactory()

AbstractApplicationContext#refreshBeanFactory()

AbstractBeanDefinitionReader#loadBeanDefinitions

AbstractBeanDefinitionReader#loadBeanDefinitions

AbstractBeanDefinitionReader#loadBeanDefinitions(String location, @Nullable Set actualResources)

AbstractBeanDefinitionReader#loadBeanDefinitions(Resource... resources)

XmlBeanDefinitionReader#loadBeanDefinitions(Resource resource)

XmlBeanDefinitionReader#loadBeanDefinitions(EncodedResource encodedResource)

XmlBeanDefinitionReader#doLoadBeanDefinitions(InputSource inputSource, Resource resource)

XmlBeanDefinitionReader#registerBeanDefinitions(Document doc, Resource resource)

DefaultBeanDefinitionDocumentReader#registerBeanDefinitions(Document doc, XmlReaderContext readerContext)

DefaultBeanDefinitionDocumentReader#doRegisterBeanDefinitions(Element root)

DefaultBeanDefinitionDocumentReader#parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate)

解析spring中的bean

DefaultBeanDefinitionDocumentReader#parseDefaultElement

DefaultBeanDefinitionDocumentReader#processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate)

BeanDefinitionParserDelegate#parseBeanDefinitionElement(Element ele)

BeanDefinitionParserDelegate#parseBeanDefinitionElement(Element ele, @Nullable BeanDefinition containingBean)

BeanDefinitionParserDelegate#parseBeanDefinitionElement(Element ele, String beanName, @Nullable BeanDefinition containingBean)
在这里解析bean标签中定义的属性,构造函数等。

BeanDefinitionParserDelegate中包含了bean相关的所有标签

解析自定义标签

BeanDefinitionParserDelegate#parseCustomElement(Element ele)

BeanDefinitionParserDelegate#parseCustomElement(Element ele, @Nullable BeanDefinition containingBd)

NamespaceHandlerSupport#parse(Element element, ParserContext parserContext)在这里进行自定义解析。dubbo就是继承了NamespaceHandlerSupport来使用自定义标签。并且实现了BeanDefinitionParser,作为自定义解析器。

你可能感兴趣的:(spring加载xml中的bean步骤)