stopwatch stopwatch = new stopwatch();
stopwatch.start();
collectionexceptionreporters = new arraylist<>();
// 配置無頭屬性, 設定該應用程式即使沒有檢測到顯示器也允許啟動
configureheadlessproperty();
// 開啟事件監聽,通知監聽者們(listener)執行相應操作
listeners.starting();
try
listeners.started(context);
}catch (throwable ex)
try
catch (throwable ex)
return context;
}
/**
* @param args 命令列引數
* @return
*/}
org.springframework.boot.context.event.eventpublishingrunlistener
private listcreatespringfactoriesinstances(classtype, class<?> parametertypes,
classloader classloader, object args, setnames)
catch (throwable ex)
}return instances;
}
// 命令列引數
this.args = args;
// 事件多播器
/*** org.springframework.boot.cloud.cloudfoundryvcapenvironmentpostprocessor,
* org.springframework.boot.autoconfigure.backgroundpreinitializer,
* org.springframework.boot.devtools.logger.devtoolslogfactory$listener,*/}
}
@override
synchronized (this.defaultretriever)
// 新增目標
// 清理檢索快取
this.retrievercache.clear();
}}
listeners.starting();
void starting()
}
呼叫eventpublishingrunlistener
中的starting()
方法。
@override
public void starting()
@override
multicastevent(event, resolvedefaulteventtype(event));
}
@override
resolvabletype type = (eventtype != null ? eventtype : resolvedefaulteventtype(event));
executor executor = gettaskexecutor();
/*** org.springframework.boot.autoconfigure.backgroundpreinitializer,
*/if (executor != null)
else
}}
errorhandler errorhandler = geterrorhandler();
if (errorhandler != null)
catch (throwable err)
}else
}@suppresswarnings()
try
catch (classcastexception ex)
}else }}
springboot原始碼略讀
springboot的精髓是自動依賴注入。那麼哪些能自動注入呢,開啟spring boot autoconfigure,jar下的spring.factories。可以看到一堆這樣的配置 auto configure org.springframework.boot.autoconfigure.en...
SpringBoot原始碼分析
public class 第乙個引數 resourceloader 資源載入器 第二個引數 primarysources 載入的主要資源類 suppresswarnings public resourceloader resourceloader,class primarysources deduc...
Spring Boot 原始碼分析
1 專案初始化過程 springboot啟動類 springboot的啟動很簡單,如下 public static void main string args this.resourceloader resourceloader initialize sources private void ini...