spring2

Posted 第二人生Bonnie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring2相关的知识,希望对你有一定的参考价值。

spring源码解析

bean的解析及注册

XmlBeanFactory.XmlBeanFactory(Resource resource,BeanFactory parentBeanFactory)

XmlBeanDefinitionReader.loadBeadDefinitions(Resource resource)

XmlBeanDefinitionReader.loadBeadDefinitions(EncodedResource encodedResource )

XmlBeanDefinitionReader.doLoadBeadDefinitions(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)

DefaultBeanDefinitionDocumentReader.parseDefaultElement(Element ele, BeanDefinitionParserDelegate delegate)

DefaultBeanDefinitionDocumentReader.processBeanDefinition(Element ele, BeanDefinitionParserDelegate delegate)

BeanDefinitionParserDelegate.parseBeanDefinitionElement(Element ele)

BeanDefinitionParserDelegate.parseBeanDefinitionElement(Element ele,@Nullable BeanDefinition ...)

BeanDefinitionParserDelegate.parseBeanDefinitionElement(Element ele,String beanName,@Nullable BeanDefinition containingBean)

创建bean对象(getBean流程)

AbstractBeanFactory.getBean(String name)

AbstractBeanFactory.doGetBean(String name,Class<T> requiredType...)

DefaultSingletonBeanRegirstry.getSingleton(String beanName)

DefaultSingletonBeanRegirstry.getSingleton(String beanName,ObjectBeanFactory<?> singletonFactory)

AbstractAutowireCapableBeanFactory.createBean(String beanName,RootBeanDefinition mbd,Object args)

 

1.创建bean对象

AbstractAutowireCapableBeanFactory.doCreateBean(String beanName,RootBeanDefinition mbd,Object args)

AbstractAutowireCapableBeanFactory.createBeanInstance(String beanName,RootBeanDefinition mbd,Object args)

instantiateBean(String beanName,RootBeanDefinition mbd)

2.填充bean的属性

3.初始化bean(init方法)

 

 

 

 

 

以上是关于spring2的主要内容,如果未能解决你的问题,请参考以下文章