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;}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/249512.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

焦旭超 201771010109《面向对象程序设计课程学习进度条》

《2018面向对象程序设计&#xff08;java&#xff09;课程学习进度条》 周次 &#xff08;阅读/编写&#xff09;代码行数 发布博客量/博客评论量 课堂/课余学习时间&#xff08;小时&#xff09; 最满意的编程任务 第一周 50/20 1/0 6/4 九九乘法表 第二周 90/5…

面试题集锦

1. L1范式和L2范式的区别 (1) L1范式是对应参数向量绝对值之和 (2) L1范式具有稀疏性 (3) L1范式可以用来作为特征选择&#xff0c;并且可解释性较强&#xff08;这里的原理是在实际Loss function 中都需要求最小值&#xff0c;根据L1的定义可知L1最小值只有0&#xff0c;故可以…

Spring注解配置工作原理源码解析

一、背景知识 在【Spring实战】Spring容器初始化完成后执行初始化数据方法一文中说要分析其实现原理&#xff0c;于是就从源码中寻找答案&#xff0c;看源码容易跑偏&#xff0c;因此应当有个主线&#xff0c;或者带着问题、目标去看&#xff0c;这样才能最大限度的提升自身代…

halt

关机 init 0 reboot init6 shutdown -r now 重启 -h now 关机 转载于:https://www.cnblogs.com/todayORtomorrow/p/10486123.html

Spring--Context

应用上下文 Spring通过应用上下文&#xff08;Application Context&#xff09;装载bean的定义并把它们组装起来。Spring应用上下文全权负责对象的创建和组装。Spring自带了多种应用上下文的实现&#xff0c;它们之间主要的区别仅仅在于如何加载配置。 1.AnnotationConfigApp…

了解PID控制

2019-03-07 【小记】 了解PID控制 比例 - 积分 - 微分 积分 --- 记忆过去 比例 --- 了解现在 微分 --- 预测未来 转载于:https://www.cnblogs.com/skullboyer/p/10487884.html

program collections

Java byte & 0xff byte[] b new byte[1];b[0] -127;System.out.println("b[0]:"b[0]"; b[0]&0xff:"(b[0] & 0xff));//output:b[0]:-127; b[0]&0xff:129计算机内二进制都是补码形式存储&#xff1a; b[0]: 补码&#xff0c;10000001&…

软件测试问题

1.什么是兼容性测试?兼容性测试侧重哪些方面? 主要检验的是软件的可移植性&#xff0c;检查软件在不同的硬件平台软件平台上是否可以正常的运行。 细分会有&#xff1a;平台的兼容&#xff0c;网络兼容&#xff0c;数据库兼容&#xff0c;数据格式的兼容等。 2.常用的测试方法…

Spring注解源码分析

我们知道如果想使用spring注解你需要在applicationContext.xml配置文件中设置context:component-scan base-packagexxx’这样spring会帮助我们扫描你所设置的目录里面所有的Bean&#xff0c;如果Bean上面有相应的Service,Controller注解&#xff08;当然还有其他的&#xff0c;…

linux查看和修改PATH环境变量的方法

查看PATH&#xff1a;echo $PATH以添加mongodb server为列修改方法一&#xff1a;export PATH/usr/local/mongodb/bin:$PATH//配置完后可以通过echo $PATH查看配置结果。生效方法&#xff1a;立即生效有效期限&#xff1a;临时改变&#xff0c;只能在当前的终端窗口中有效&…

GLog 初始化说明

#include <iostream> #include <glog/logging.h>int main(int argc, char* argv[]) {google::InitGoogleLogging(argv[0]);FLAGS_logtostderr false; // 是否将日志输出到stderr而非文件。FLAGS_alsologtostderr false; //是否将日志输出到文件和stderr&#xff…

Spring ConfigurationClassPostProcessor Bean解析及自注册过程

一bean的自注册过程 二,自注册过程说明 1 configurationclassparser解析流程 1、处理PropertySources注解&#xff0c;配置信息的解析 2、处理ComponentScan注解&#xff1a;使用ComponentScanAnnotationParser扫描basePackage下的需要解析的类(SpringBootApplication注解也包…

新华社:华尔街专家警告2019年美股或面临剧烈调整

新华社&#xff1a;华尔街专家警告2019年美股或面临剧烈调整 2018年08月14日 12:34 新华社新浪财经APP缩小字体放大字体收藏微博微信分享转载于:https://www.cnblogs.com/hjlweilong/p/9664677.html

java定义注解

小伙伴们。今天我们来说说注解、标志 。针对java不同版本来说&#xff0c;注解的出现是在jdk1.5 但是在jdk1.5版本使用注解必须继续类的方法的重写&#xff0c;不能用于实现的接口中的方法实现&#xff0c;在jdk1.6环境下对于继续和实现都是用。 jdk1.5版本内置了三种标准的注…

2018.09.18 while循环

** "loop" 循环 注意要有引号。 **pass 过 #打印 1-100start 1 while start < 101:print("loop",start)start 1 #打印1-49&#xff0c;81-100. 60-80的平方start 1 while start <101 :if start >49 and start < 60:passelif start >5…

2019第二周作业

基础作业 实验代码 #include<stdlib.h> int main(void) {FILE*fp;int num[4],i,b,max;char op;if((fpfopen("c:\\tmj.txt","r"))NULL){ printf("File open error!\n"); exit(0);}for(i0;i<4;i){fscanf(fp,"%d%c",&nu…

实验一(高见老师收)

学 号201521450016 中国人民公安大学 Chinese people’ public security university 网络对抗技术 实验报告 实验一 网络侦查与网络扫描 学生姓名 陈璪琛 年级 2015 区队 五 指导教师 高见 信息技术与网络安全学院 2018年9月18日 实验任务总纲 2018—2019学年…

GitHub笔记(二)——远程仓库的操作

二 远程仓库 1 创建联系 第1步&#xff1a;创建SSH Key。在用户主目录下&#xff0c;看看有没有.ssh目录&#xff0c;如果有&#xff0c;再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件&#xff0c;如果已经有了&#xff0c;可直接跳到下一步。如果没有&#xff0c;打开S…

QT 子窗体 最大化 界面显示不对

QT 子窗体 最大化 复原 遇到的问题 项目中有个需求&#xff0c;主窗体中嵌套子窗体&#xff0c;需要将子窗体最大化显示和复原。 查了很多资料&#xff0c;基本上都是提到&#xff1a;QT中窗口部件QWidget成员函数showFullScreen();是用于将窗口部件全屏显示&#xff0c;但是他…

Spring 钩子之BeanFactoryPostProcessor和BeanPostProcessor

BeanFactoryPostProcessor和BeanPostProcessor这两个接口都是初始化bean时对外暴露的入口之一&#xff0c;和Aware类似&#xff08;PS:关于spring的hook可以看看Spring钩子方法和钩子接口的使用详解讲的蛮详细&#xff09;本文也主要是学习具体的钩子的细节&#xff0c;以便于实…