<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                在開發中一般會配置不同的環境,這樣方便切換不同的資源。如開發環境、測試環境、生產環境等。 [TOC] # 1. `.properties`多環境配置 `.properties`配置文件命名規范:`application-**.properties`。 <br/> **1. 不同環境的配置文件** (1)開發環境配置文件。 *`resources/application-dev.properties`* ```properties server.port=8080 ``` (2)生產環境配置文件。 *`resources/application-pro.properties`* ```properties server.port=9090 ``` (3)springboot默認配置文件,在該文件中決定使用哪個配置文件。 *`resources/application.properties`* ```properties #可以在默認的配置文件中配置共享的資源 server.servlet.context-path=/boot #使用生產環境的配置文件 spring.profiles.active=pro ``` **2. 測試** 啟動項目,控制臺會打印如下日志。 ``` : The following profiles are active: pro #當前使用的環境是pro : Tomcat initialized with port(s): 9090 (http) #當前環境的端口是9090 : Tomcat started on port(s): 9090 (http) with context path '/boot' #當前的項目根路徑是/boot ``` **** 案例代碼:https://gitee.com/flymini/codes01/tree/master/springboot_/com-learn-boot05 <br/> # 2.`.yml`多環境配置 **1. 多環境配置** 使用`.yml`進行多環境配置只需一個`resources/application.yml`文件即可。 ```yml spring: profiles: active: test # 使用測試環境的配置 #共享配置 server: servlet: context-path: /boot --- spring: profiles: dev #開發環境的配置 server: port: 8080 --- spring: profiles: test #測試環境的配置 server: port: 9090 ``` **2. 測試** 啟動項目,控制臺會打印如下日志。 ``` : The following profiles are active: test #當前使用的環境是test : Tomcat initialized with port(s): 9090 (http) #當前環境的端口是9090 : Tomcat started on port(s): 9090 (http) with context path '/boot' #當前的項目根路徑是/boot ``` **** 案例代碼:https://gitee.com/flymini/codes01/tree/master/springboot_/com-learn-boot06
                  <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>

                              哎呀哎呀视频在线观看