Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of knowledge points of Spring Source Code

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "Spring source knowledge point analysis", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Spring source knowledge point analysis" it!

Analysis of XmlBeanFactory core classes: DefaultListableBeanFactory, XmlBeanDefinitionReader

Public class XmlBeanFactory extends DefaultListableBeanFactory {private final XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader (this); / * * Create a new XmlBeanFactory with the given resource, * which must be parsable using DOM. * @ param resource XML resource to load bean definitions from * @ throws BeansException in case of loading or parsing errors * / public XmlBeanFactory (Resource resource) throws BeansException {this (resource, null);} / * Create a new XmlBeanFactory with the given input stream, * which must be parsable using DOM. * @ param resource XML resource to load bean definitions from * @ param parentBeanFactory parent bean factory * @ throws BeansException in case of loading or parsing errors * / public XmlBeanFactory (Resource resource, BeanFactory parentBeanFactory) throws BeansException {super (parentBeanFactory); this.reader.loadBeanDefinitions (resource);}}

DefaultListableBeanFactory

XmlBeanFactory inherits from DefaultListableBeanFactory. The DefaultListableBeanFactory role is responsible for the default implementation of Spring Bean registration and loading.

AliasRegistry: the public interface manages aliases

BeanDefinitionRegistry: define various administrative operations for BeanDefinitionRegistry

SimpleAliasRegistry: use map as the cache for alias, and implement the AliasRegistry interface

SingletonBeanRegistry: define the interface for registering and obtaining singletons

BeanFactory: define various properties for getting bean and bean

DefaultSingletonBeanRegistry: default implementation of the SingletonBeanRegistry interface

HierarchicalBeanFactory: inherits the function of BeanFactory interface and adds support for parentFactoryBean

ListableBeanFactory: get the configuration list of bean according to various conditions

FactoryBeanRegistrySupport: added support for FactoryBean based on the functions of DefaultSingletonBeanRegistry

ConfigurableBeanFactory: provides various configuration methods for BeanFactory

AbstractBeanFactory: provides support for FactoryBeanRegistrySupport functions and ConfigurableBeanFactory interface implementation

AutowireCapableBeanFactory: defines interface creation bean, automatic injection, initialization, and back-end processing for applying Bean

AbstractAutowireCapableBeanFactory: inherits AbstractBeanFactory

And implement all the functions of the AutowireCapableBeanFactory interface

ConfigurableListableBeanFactory: comprehensive configuration of most of the interfaces that BeanFactory will implement

XmlBeanDefinitionReader

XmlBeanDefinitionReader is referenced in XmlBeanFactory. The XmlBeanDefinitionReader role is responsible for reading, parsing, and registering from Resource resource files.

ResourceLoader: defines a resource loader, which is mainly applied to the Resource returned by a given resource file address

BeanDefinitionReader: defines the bean interface to read from the resource file and convert it to BeanDefinitionReader

EnvironmentCapable: define the method to get Enviroment

BeanDefinitionDocumentReader: interface definition reads Document and registers BeanDefinition function

BeanDefinitionParserDelegate: define various methods for parsing Element

DocumentLoader: defines the ability to load from a resource file to convert to Document

AbstractBeanDefinitionReader: implementation of interfaces EnvironmentCapable and BeanDefinitionReader

DefaultBeanDefinitionDocumentReader: implementation of the BeanDefinitionDocumentReader interface

At this point, I believe that everyone on the "Spring source knowledge point analysis" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report