SpringBoot源码----真正的bean工厂DefaultListableBeanFactory

类的注解和翻译:

/**
 * Spring's default implementation of the {@link ConfigurableListableBeanFactory}
 * and {@link BeanDefinitionRegistry} interfaces: a full-fledged bean factory
 * based on bean definition metadata, extensible through post-processors.
 *
 * <p>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.
 *
 * <p>Note that readers for specific bean definition formats are typically
 * implemented separately rather than as bean factory subclasses:
 * see for example {@link PropertiesBeanDefinitionReader} and
 * {@link org.springframework.beans.factory.xml.XmlBeanDefinitionReader}.
 *
 * <p>For an alternative implementation of the
 * {@link org.springframework.beans.factory.ListableBeanFactory} interface,
 * have a look at {@link StaticListableBeanFactory}, which manages existing
 * bean instances rather than creating new ones based on bean definitions.
 */
Spring的ConfigurableListableBeanFactory和BeanDefinitionRegistry接口的默认实现:基于bean定义元数据的成熟bean工厂,可通过后处理器进行扩展。
典型的用法是在访问bean之前先注册所有bean定义(可能是从bean定义文件中读取)。因此,按名称查找Bean是在本地Bean定义表中进行的廉价操作,它对预解析的Bean定义元数据对象进行操作。
注意,特定bean定义格式的阅读器通常是单独实现的,而不是作为bean工厂的子类实现的:例如,参见PropertiesBeanDefinitionReader和org.springframework.beans.factory.xml.XmlBeanDefinitionReader。
对于org.springframework.beans.factory.ListableBeanFactory接口的替代实现,请看一下StaticListableBeanFactory,它管理现有的bean实例,而不是根据bean定义创建新的bean实例。

 

类图:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值