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

                [TOC] ## 一、背景 官方提供的spring boot starter的配置項,我們用IDE配置的時候一般都有自動提示的,如下圖所示 ![](https://img.kancloud.cn/a1/6b/a16bccaf2ec602e05b86f3cecdccf969_974x566.png) 而我們自己自定義的配置卻沒有,對開發非常不友好容易打錯配置,**那這個是怎樣實現的呢?** &nbsp; ## 二、提示原理 IDE是通過讀取配置信息的元數據而實現自動提示的,而元數據在目錄`META-INF`中的`spring-configuration-metadata.json` 或者 `additional-spring-configuration-metadata.json` &nbsp; ## 三、實現自動提示 以我這個自己開發的starter中的自定義配置文件為例,如果自己手動創建這些元數據的話工作量比較大,使用`IDEA`的話有自動生成功能 ![](https://img.kancloud.cn/6f/b2/6fb245ade5df31ac6be8dc8f82a4708c_1253x698.png) &nbsp; ### 3.1. 引入依賴spring-boot-configuration-processor 在`zlt-swagger2-spring-boot-starter`工程中添加以下jar包 ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> ``` &nbsp; ### 3.2. 修改IDEA配置 搜索`Annotation Processor`并設置`Enable annotation processing` ![](https://img.kancloud.cn/dd/e0/dde01477b97387c9b7a8dc6ea96193ec_1561x659.png) &nbsp; ### 3.3. 重新編譯項目 項目在重新編譯后就會自動生成`spring-configuration-metadata.json`文件 ![](https://img.kancloud.cn/73/18/73188088e5e6920b47db68319a1ebb2b_1706x257.png) &nbsp; ## 四、測試 自定義的swagger配置已經能自動提示了 ![](https://img.kancloud.cn/cc/9e/cc9e48cd2c6e9616fc5e59b3eb44d106_965x532.png) &nbsp; **參考資料** [https://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html](https://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html)
                  <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>

                              哎呀哎呀视频在线观看