ConfigurableListableBeanFactory
ConfigurableListableBeanFactory 提供bean definition的解析,注册功能,再对单例来个预加载(解决循环依赖问题).
貌似我们一般开发就会直接定义这么个接口了事.而不是像Spring这样先根据使用情况细分那么多,到这边再合并
ConfigurableListableBeanFactory具体:
1、2个忽略自动装配的的方法。
2、1个注册一个可分解依赖的方法。
3、1个判断指定的Bean是否有资格作为自动装配的候选者的方法。
4、1个根据指定bean名,返回注册的Bean定义的方法。
5、2个冻结所有的Bean配置相关的方法。
6、1个使所有的非延迟加载的单例类都实例化的方法。
总结:工厂接口ConfigurableListableBeanFactory同时继承了3个接口,ListableBeanFactory、AutowireCapableBeanFactory 和 ConfigurableBeanFactory,扩展之后,加上自有的这8个方法,这个工厂接口总共有83个方法,实在是巨大到不行了。这个工厂接口的自有方法总体上只是对父类接口功能的补充,包含了BeanFactory体系目前的所有方法,可以说是接口的集大成者。
/*** Configuration interface to be implemented by most listable bean factories.* In addition to {@link ConfigurableBeanFactory}, it provides facilities to* analyze and modify bean definitions, and to pre-instantiate singletons.** <p>This subinterface of {@link org.springframework.beans.factory.BeanFactory}* is not meant to be used in normal application code: Stick to* {@link org.springframework.beans.factory.BeanFactory} or* {@link org.springframework.beans.factory.ListableBeanFactory} for typical* use cases. This interface is just meant to allow for framework-internal* plug'n'play even when needing access to bean factory configuration methods.** @author Juergen Hoeller* @since 03.11.2003* @see org.springframework.context.support.AbstractApplicationContext#getBeanFactory()*/
public interface ConfigurableListableBeanFactoryextends ListableBeanFactory, AutowireCapableBeanFactory, ConfigurableBeanFactory {//-------------------------------------------------------------------------// 设置忽略的依赖关系,注册找到的特殊依赖//-------------------------------------------------------------------------/*** Ignore the given dependency type for autowiring:* for example, String. Default is none.* @param type the dependency type to ignore*///忽略自动装配的依赖类型void ignoreDependencyType(Class<?> type);/*** Ignore the given dependency interface for autowiring.* <p>This will typically be used by application contexts to register* dependencies that are resolved in other ways, like BeanFactory through* BeanFactoryAware or ApplicationContext through ApplicationContextAware.* <p>By default, only the BeanFactoryAware interface is ignored.* For further types to ignore, invoke this method for each type.* @param ifc the dependency interface to ignore* @see org.springframework.beans.factory.BeanFactoryAware* @see org.springframework.context.ApplicationContextAware*///忽略自动装配的接口void ignoreDependencyInterface(Class<?> ifc);/*** Register a special dependency type with corresponding autowired value.* <p>This is intended for factory/context references that are supposed* to be autowirable but are not defined as beans in the factory:* e.g. a dependency of type ApplicationContext resolved to the* ApplicationContext instance that the bean is living in.* <p>Note: There are no such default types registered in a plain BeanFactory,* not even for the BeanFactory interface itself.* @param dependencyType the dependency type to register. This will typically* be a base interface such as BeanFactory, with extensions of it resolved* as well if declared as an autowiring dependency (e.g. ListableBeanFactory),* as long as the given value actually implements the extended interface.* @param autowiredValue the corresponding autowired value. This may also be an* implementation of the {@link org.springframework.beans.factory.ObjectFactory}* interface, which allows for lazy resolution of the actual target value.*//** 注册一个可分解的依赖*/void registerResolvableDependency(Class<?> dependencyType, Object autowiredValue);/*** Determine whether the specified bean qualifies as an autowire candidate,* to be injected into other beans which declare a dependency of matching type.* <p>This method checks ancestor factories as well.* @param beanName the name of the bean to check* @param descriptor the descriptor of the dependency to resolve* @return whether the bean should be considered as autowire candidate* @throws NoSuchBeanDefinitionException if there is no bean with the given name*//** 判断指定的Bean是否有资格作为自动装配的候选者*/boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor)throws NoSuchBeanDefinitionException;//-------------------------------------------------------------------------// 获取bean定义 (可以访问属性值跟构造方法的参数值)//-------------------------------------------------------------------------/*** Return the registered BeanDefinition for the specified bean, allowing access* to its property values and constructor argument value (which can be* modified during bean factory post-processing).* <p>A returned BeanDefinition object should not be a copy but the original* definition object as registered in the factory. This means that it should* be castable to a more specific implementation type, if necessary.* <p><b>NOTE:</b> This method does <i>not</i> consider ancestor factories.* It is only meant for accessing local bean definitions of this factory.* @param beanName the name of the bean* @return the registered BeanDefinition* @throws NoSuchBeanDefinitionException if there is no bean with the given name* defined in this factory*//** 返回注册的Bean定义*/BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException;/*** Return a unified view over all bean names managed by this factory.* <p>Includes bean definition names as well as names of manually registered* singleton instances, with bean definition names consistently coming first,* analogous to how type/annotation specific retrieval of bean names works.* @return the composite iterator for the bean names view* @since 4.1.2* @see #containsBeanDefinition* @see #registerSingleton* @see #getBeanNamesForType* @see #getBeanNamesForAnnotation*/Iterator<String> getBeanNamesIterator();/*** Clear the merged bean definition cache, removing entries for beans* which are not considered eligible for full metadata caching yet.* <p>Typically triggered after changes to the original bean definitions,* e.g. after applying a {@link BeanFactoryPostProcessor}. Note that metadata* for beans which have already been created at this point will be kept around.* @since 4.2* @see #getBeanDefinition* @see #getMergedBeanDefinition*/void clearMetadataCache();//-------------------------------------------------------------------------// 锁定配置信息.在调用refresh时会使用到.//-------------------------------------------------------------------------/*** Freeze all bean definitions, signalling that the registered bean definitions* will not be modified or post-processed any further.* <p>This allows the factory to aggressively cache bean definition metadata.*///暂时冻结所有的Bean配置void freezeConfiguration();/*** Return whether this factory's bean definitions are frozen,* i.e. are not supposed to be modified or post-processed any further.* @return {@code true} if the factory's configuration is considered frozen*///判断本工厂配置是否被冻结boolean isConfigurationFrozen();//-------------------------------------------------------------------------// 预加载不是懒加载的单例.用于解决循环依赖问题//-------------------------------------------------------------------------/*** Ensure that all non-lazy-init singletons are instantiated, also considering* {@link org.springframework.beans.factory.FactoryBean FactoryBeans}.* Typically invoked at the end of factory setup, if desired.* @throws BeansException if one of the singleton beans could not be created.* Note: This may have left the factory with some beans already initialized!* Call {@link #destroySingletons()} for full cleanup in this case.* @see #destroySingletons()*///使所有的非延迟加载的单例类都实例化。void preInstantiateSingletons() throws BeansException;}
ConfigurableListableBeanFactory相关推荐
- Spring : ConfigurableListableBeanFactory
1.美图 2.概述 2.1 拓扑图 ConfigurableListableBeanFactory–> ListableBeanFactory–>BeanFactory Configura ...
- class没有发布到tomcat_Tomcat 在 SpringBoot 中是如何启动的
前言[1] 从 Main 方法说起[2] 走进 Tomcat 内部[3] 总结[4] <Java 2019 超神之路> <Dubbo 实现原理与源码解析 -- 精品合集> &l ...
- 深入理解Spring系列之六:bean初始化
<深入理解Spring系列之四:BeanDefinition装载前奏曲>中提到,对于非延迟单例bean的初始化在finishBeanFactoryInitialization(beanFa ...
- java中读取properties文件内容五种方式
一.背景 最近,在项目开发的过程中,遇到需要在properties文件中定义一些自定义的变量,以供java程序动态的读取,修改变量,不再需要修改代码的问题.就借此机会把Spring+SpringMVC ...
- Spring BeanDefinitionRegistryPostProcessor BeanPostProcessor作用
写博客,写博客,把自己知道的小知识点全部记录,? BeanDefinitionRegistryPostProcessor 接口属于Beanddefination 装配定义的范畴,此时bean 并没有 ...
- 加载BeanFactory
前言 上一篇文章讲述了ApplicationContext扩展功能的之一:环境准备.这篇文章接着讲述ApplicationContext的扩展功能-----加载BeanFactory,也就是初始化Be ...
- Spring Boot启动过程(二)
书接上篇 该说refreshContext(context)了,首先是判断context是否是AbstractApplicationContext派生类的实例,之后调用了强转为AbstractAppl ...
- 将Bean放入Spring容器中的五种方式
欢迎关注方志朋的博客,回复"666"获面试宝典 来源:blog.csdn.net/weixin_43741092/ article/details/120176466 将bean放 ...
- 惊呆了,Spring中竟然有12种定义bean的方法
前言 在庞大的 Java 技术体系中,Spring 有着举足轻重的地位,它给每位开发者带来了极大的便利和惊喜. 我们都知道 Spring 是创建和管理bean的工厂,它提供了多种方式定义 bean,能 ...
最新文章
- spring boot中的日志入门
- 重磅发布!Google语义分割新数据集来啦!又一个分割SOTA模型
- cross--向量或矩阵的叉乘
- scrapy基础知识之制作 Scrapy 爬虫 一共需要4步:
- php判断子字符串位置,PHP怎样查询子字符串位置
- 【模拟】签订协议(nowcoder 217601)
- mac wordpress php7,Mac 下基于 wordpress 搭建个人博客系统
- hdu-1521 排列组合 指数型母函数
- pb 执行insert 后return是否会自动提交_一条MySQL更新语句是怎么执行的?
- 支付宝疯起来连自己都打
- DiskGenius是一款硬盘分区及数据恢复软件
- Freenom免费域名申请
- 创建对象的几种常用写法
- 春招+秋招核心面试问题
- Vue实现前端3D展示及node环境搭建
- 计算机毕业设计Java超市网站(源码+系统+mysql数据库+lw文档)
- apache服务器wind 下载,安装及部署
- PHP大作业_课程设计_教务在线系统
- [串口屏定义2022最新版]什么是串口屏?串口屏组成及串口屏方案
- 做到这5步,让用户离不开你 #数据训练营#
热门文章
- jupyter notebook怎么写python代码_如何在Jupyter Notebook中使用Python虚拟环境?
- golang 捕获堆栈信息_【网络数据安全】为什么时间戳对于数据包捕获很重要
- 基于android 定位系统,基于Android平台定位系统设计和实现
- python英文词云代码_使用python实现个性化词云的方法
- date oracle 显示毫秒_Oracle date timestamp 毫秒 - 时间函数总结
- 计算机地址码特点,电脑摇头灯的地址码的设定问题你必须要注意的
- c语言最简单程序实例,C语言第一个简单实例
- php导出excel出现乱码,php导出数据到excel出现乱码的解决办法
- antd table 时间搜索_antd table按表格里的日期去排序操作
- Faster R-CNN的安装及测试(Python版本和Matlab版本)