<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                CommandLineRunner 接口可以實現當服務啟動時預先加載一些功能,比如參數預先加載等。當需要實現多個功能預先加載時,需要使用`@Order`來指定加載的順序。 ```java public @interface Order { int value() default 2147483647; //該值越小,越先被執行 } ``` 使用步驟如下: **1. 創建SpringBoot項目** **2. 創建三個類來實現CommandLineRunner接口** (1)CommandLineRunnerDriver1。 ```java import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @Component @Order(value = 1) public class CommandLineRunnerDriver1 implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println("CommandLineRunnerDriver1執行成功!"); } } ``` (2)CommandLineRunnerDriver2。 ```java import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @Component @Order(value = 2) public class CommandLineRunnerDriver2 implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println("CommandLineRunnerDriver2執行成功!"); } } ``` (3)CommandLineRunnerDriver3。 ```java import org.springframework.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @Component @Order(value = 3) public class CommandLineRunnerDriver3 implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println("CommandLineRunnerDriver3執行成功!"); } } ``` **3. 運行啟動類,預加載的順序如下** ``` CommandL ineRunnerDriver1執行成功! CommandL ineRunnerDriver2執行成功! CommandL ineRunnerDriver3執行成功! ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看