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.pswp.cn/news/249512.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/249512.shtml
英文地址,請注明出處:http://en.pswp.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;以便于實…