写点什么

Spring 源码解析 -Bean

用户头像
云淡风轻
关注
发布于: 2020 年 06 月 17 日

Spring IOC 定义类

Bean定义

BeanDefinition

A BeanDefinition describes a bean instance, which has property values, constructor argument values, and further information supplied by concrete implementations.

This is just a minimal interface: The main intention is to allow a BeanFactoryPostProcessor to introspect and modify property values and other bean metadata.



AbstractBeanDefinition

Base class for concrete, full-fledged BeanDefinition classes, factoring out common properties of GenericBeanDefinition, RootBeanDefinition, and ChildBeanDefinition.



GenericBeanDefinition/RootBeanDefinition/ChildBeanDefinition

GenericBeanDefinition is a one-stop shop for standard bean definition purposes. Like any bean definition, it allows for specifying a class plus optionally constructor argument values and property values. Additionally, deriving from a parent bean definition can be flexibly configured through the "parentName" property.

In general, use this GenericBeanDefinition class for the purpose of registering user-visible bean definitions (which a post-processor might operate on, potentially even reconfiguring the parent name). Use RootBeanDefinition / ChildBeanDefinition where parent/child relationships happen to be pre-determined.



AnnotatedGenericBeanDefinition

Extension of the GenericBeanDefinition class, adding support for annotation metadata exposed through the AnnotatedBeanDefinition interface.



ScannedGenericBeanDefinition

Extension of the GenericBeanDefinition class, based on an ASM ClassReader, with support for annotation metadata exposed through the AnnotatedBeanDefinition interface.



Bean容器

BeanDefinitionHolder

Holder for a BeanDefinition with name and aliases. Can be registered as a placeholder for an inner bean. Can also be used for programmatic registration of inner bean definitions. If you don't care about BeanNameAware and the like, registering RootBeanDefinition or ChildBeanDefinition is good enough.



BeanComponentDefinition

ComponentDefinition based on a standard BeanDefinition, exposing the given bean definition as well as inner bean definitions and bean references for the given bean.



Bean读取器

BeanDefinitionReader

Simple interface for bean definition readers. Specifies load methods with Resource and String location parameters.



AbstractBeanDefinitionReader

Abstract base class for bean definition readers which implement the BeanDefinitionReader interface.



PropertiesBeanDefinitionReader

Bean definition reader for a simple properties format.



XmlBeanDefinitionReader

Bean definition reader for XML bean definitions. Delegates the actual XML document reading to an implementation of the BeanDefinitionDocumentReader interface.



Bean解析

BeanDefinitionParser

Interface used by the DefaultBeanDefinitionDocumentReader to handle custom, top-level (directly under <beans/>) tags.



AbstractBeanDefinitionParser

Abstract BeanDefinitionParser implementation providing a number of convenience methods and a AbstractBeanDefinitionParser#parseInternal template method that subclasses must override to provide the actual parsing logic.



AbstractSingleBeanDefinitionParser

Base class for those BeanDefinitionParser implementations that need to parse and define just a single BeanDefinition



AbstractSimpleBeanDefinitionParser

Convenient base class for when there exists a one-to-one mapping between attribute names on the element that is to be parsed and the property names on the Class being configured.



Bean注册

AliasRegistry

Common interface for managing aliases. Serves as super-interface for BeanDefinitionRegistry



BeanDefinitionRegistry

Interface for registries that hold bean definitions, for example RootBeanDefinition and ChildBeanDefinition instances. Typically implemented by BeanFactories that internally work with the AbstractBeanDefinition hierarchy.



DefaultListableBeanFactory

Spring's default implementation of the ConfigurableListableBeanFactory and BeanDefinitionRegistry interfaces: a full-fledged bean factory based on bean definition metadata, extensible through post-processors.

Typical usage is registering all bean definitions first (possibly read from a bean definition file), before accessing beans. Bean lookup by name is therefore an inexpensive operation in a local bean definition table, operating on pre-resolved bean definition metadata objects.





Bean引用

BeanReference

Interface that exposes a reference to a bean name in an abstract fashion. Serves as common interface implemented by any kind of bean reference holder, such as RuntimeBeanReference and RuntimeBeanNameReference.



RuntimeBeanReference

Immutable placeholder class used for a property value object when it's a reference to another bean in the factory, to be resolved at runtime.



RuntimeBeanNameReference

Immutable placeholder class used for a property value object when it's a reference to another bean name in the factory, to be resolved at runtime.



用户头像

云淡风轻

关注

云淡风轻 2018.08.18 加入

JAVA软件工程师

评论

发布
暂无评论
Spring源码解析-Bean