------- SpringApplication.runの論理解析(b)の説明を開始springboot

これは、リンクのために呼び出します。

    org.springframework.boot.SpringApplication.run(SpringApplication.java:296で
    :org.springframework.boot.SpringApplication.run(SpringApplication.javaで 1260 
    org.springframework.boot.SpringApplication.run(SpringApplication.javaで: 1248 
    com.ivy.demo.DemoApplication.mainで(DemoApplication.java: 16)

コード:

公共ConfigurableApplicationContext RUN(文字列...引数){ 
        ストップウォッチストップウォッチ = 新しい新しいストップウォッチ(); 
     //録画開始時間(1) stopWatch.start(); ConfigurableApplicationContextコンテキスト
= ヌル; コレクション <SpringBootExceptionReporter> = exceptionReporters 新しい新しいのArrayList <> ); configureHeadlessPropertyは();
     //(2)すべてのSpringApplicationRunListener実装クラスの構成を取得し、そしてSpringApplicationRunListenersクラスにカプセル化された リスナーSpringApplicationRunListeners
= ; getRunListeners(引数)を
     。。//(3)は、出発リスナーメソッドのリストを呼び出し )(listeners.starting;
{トライ ApplicationArgumentsのapplicationArgumentsは = 新しい新しいDefaultApplicationArguments( 引数);
       //環境準備(4) ConfigurableEnvironment環境
= prepareEnvironment(リスナー、 applicationArgumentsを);
       //(5)の構成は、プロパティがspring.beaninfo.ignore無視されます configureIgnoreBeanInfo(環境);
       //(6)フォントを歓迎するオープン。 バナーprintedBanner
= printBanner(環境);
       //(7)を作成するのApplicationContext コンテキスト
= createApplicationContext()。
       //(8)获取错误报告类。 exceptionReporters
.mainApplicationClass)= (getSpringFactoriesInstances 。SpringBootExceptionReporter クラス新しいクラス[] {ConfigurableApplicationContext。クラス}、コンテキスト)。 prepareContext(コンテキスト、環境、リスナー、applicationArguments、 printedBanner)。 refreshContext(コンテキスト)。 afterRefresh(コンテキスト、applicationArguments)。 stopWatch.stop(); もしこの.logStartupInfo){ 新しい StartupInfoLogger(この .logStarted(getApplicationLog()、ストップウォッチ)。 } listeners.started(コンテキスト)。 callRunners(コンテキスト、applicationArguments)。 } キャッチ(ThrowableのEX){ handleRunFailure(文脈、EX、exceptionReporters、リスナー)。 スロー 新しいIllegalStateExceptionを(EX)を、 } 試みる{ listeners.running(コンテキスト)。 } キャッチ(ThrowableのEX){ handleRunFailure(文脈、EX、exceptionReporters、NULL ); スロー 新しいIllegalStateExceptionを(EX)を、 } 戻りコンテキスト; }

 

おすすめ

転載: www.cnblogs.com/itivy/p/11669174.html