一、contextloaderlistener上下文載入器的***
呼叫contextinitialized
contextclass是通過spring自帶的配置檔案獲取的。
3.啟用this.context
可載入context的父上下文
this.context.setid("/boxing_plan" )
setservletcontext
setconfiglocation( "classpath*:config/spring-*.xml")
4. postprocessbeanfactory(beanfactory);
beanfactory.registerscope
contextattributes,tempdir..web.xml
5.invokebeanfactorypostprocessors(beanfactory);{
beanfactory.getbeansoftype會去獲取如果存在會進行bean初始化
internalconfigurationannotationprocessor=configurationclasspostprocessor
configurationclasspostprocessor.postprocessbeandefinitionregistry(registry)
configurationclasspostprocessor.postprocessbeanfactory(beanfactory)
這裡可自定義屬於自己的beanfactorypostprocessor
6.registerbeanpostprocessors(beanfactory){
以下的bean也會被初始化
獲取beanpostprocessor.class
beanfactory.addbeanpostprocessor(newbeanpostprocessorchecker(beanfactory, beanprocessortargetcount));
處理 優先順序priorityordered 沒優先順序順序ordered 無序列
priorityordered
autowiredannotationbeanpostprocessor
instanceof mergedbeandefinitionpostprocessor-> internalpostprocessors.add
requiredannotationbeanpostprocessor internalpostprocessors.add
commonannotationbeanpostprocessor internalpostprocessors.add
configurationclasspostprocessor$importawarebeanpostprocessor
ordered
internalautoproxycreator
noneordered
ordercomparator.sort(priorityorderedpostprocessors)
beanfactory.addbeanpostprocessor
proxytargetclass
7. initmessagesource();{
可自定義messagesource
new delegatingmessagesource()
beanfactory.registersingleton(messagesource,delegatingmessagesource)
9. onrefresh();{
this.themesource =resourcebundlethemesource
10. registerlisteners();{
11. finishbeanfactoryinitialization(beanfactory);{
beanfactory.settempclassloader(null);
beanfactory.freezeconfiguration();//快取所有bean的物件,不能被改變
beanfactory.preinstantiatesingletons();確保所有bean都被例項化了{
//例項化所有非懶載入的單例bean
//區分工廠bean和普通bean
工廠bean有sqlmapclientfactorybean
12. finishrefresh();{
initlifecycleprocessor()->newdefaultlifecycleprocessor()
beanfactory.setlifecycleprocessor lifecycleprocessor.setbeanfacotry
lifecyclebeans暫時沒用到
new contextrefreshedevent(this)
ReentrantLock原始碼詳細解讀
reentrantlock是面試中的高頻考點,其中實現原理還是很有必要了解的。它與synchronized類似,都是互斥鎖,但具有更好的擴充套件性。reentrantlock是基於aqs實現的,遺忘的同學可以回顧一下aqs原始碼詳細解讀。1.1 繼承關係概述 首先看一下繼承關係圖,對它整體的構造有乙...
Set原始碼詳細解析
class myset 不是可迭代物件 this datas 空陣列來接收值 for const item of iterator 新增 add data 判斷物件裡面是否有某個值 has data return false 判斷兩個值是否相等 isequal data1,data2 return ...
loadEXEPE感染詳細VC原始碼注釋
實現將筆記本程式插入到計算器程式並替換掉程式程序名 include stdafx.h include include struct mzheader dos struct pe header struct pe extheader struct sectionheader 只定義了乙個節表達結構是乙...