Spring源碼解析(轉別人鏈接)

主题:spring源码分析-XmlBeanFactory导读

private final XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this);

public class XmlBeanFactory extends DefaultListableBeanFactory

public XmlBeanFactory(Resource resource)

public XmlBeanFactory(Resource resource, BeanFactory parentBeanFactory)

 

 

利用this.reader.loadBeanDefinitions(resource);

進行解析 

->XmlBeanDefinitionReader方法: 用new EncodedResource(resource)包裝 

 

 構造:inputSource

   InputStream inputStream = encodedResource.getResource().getInputStream();
   InputSource inputSource = new InputSource(inputStream);

doLoadBeanDefinitions(inputSource, encodedResource.getResource()); 

 

構造:Document

Document doc = this.documentLoader.loadDocument(
     inputSource, this.entityResolver, this.errorHandler, validationMode, this.namespaceAware);

 

解析方法:

registerBeanDefinitions(Document doc, Resource resource)

 

構造:XmlBeanDefinitionParser

if (this.parserClass != null) {
   XmlBeanDefinitionParser parser =
     (XmlBeanDefinitionParser) BeanUtils.instantiateClass(this.parserClass);
   return parser.registerBeanDefinitions(this, doc, resource);
  }

 

 

你可能感兴趣的:(spring)