亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

SpringCloud Gateway與swagger集成解決方案

發布時間:2020-07-09 06:21:47 來源:網絡 閱讀:7950 作者:HappyBoyLi 欄目:建站服務器

spring cloud gateway 底層采用的是webflux,swagger2暫時不支持webflux,網上的解決方案雖然有一些,比如這篇文章 還有《重新定義spring cloud 實戰》這本書也有解決方案,書源碼鏈接,
我們項目里面采用的是集成了最新的swagger3 snapshot版本,需要引入的pom文件有:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-integration</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-spring-webflux</artifactId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-spring-integration-webflux</artifactId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

                還要引入資源庫
                <repositories>
        <repository>
            <id>jcenter-snapshots</id>
            <name>jcenter</name>
            <url>http://oss.jfrog.org/simple/oss-snapshot-local/io/springfox/</url>
            <releases>
               <enabled>false</enabled>
            </releases>
            <snapshots>
               <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

因為公司的構建系統只代理這幾個倉庫:
http://repo1.maven.org/maven2/
http://jcenter.bintray.com/
http://repo.grails.org/grails/core/

所以雖然本地可以調試,但是服務器上構建失敗,最后結局方案是,把swagger3的jar包引入本地lib文件,然后在pom中引入,解決問題。這是一個細心的活~
pom文件

<dependency>
            <groupId>classgraph</groupId>
            <artifactId>classgraph</artifactId>
            <version>4.1.7</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/classgraph-4.1.7.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>classmate</groupId>
            <artifactId>classmate</artifactId>
            <version>1.4.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/classmate-1.4.0.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>1.2.0.Final</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/mapstruct-1.2.0.Final.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>rawhttp</groupId>
            <artifactId>rawhttp</artifactId>
            <version>2.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/rawhttp-core-2.0.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-core-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-schema</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-schema-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-spi</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-spi-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-spring-integration</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-spring-integration-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-spring-integration-webflux</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-spring-integration-webflux-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-spring-web</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-spring-web-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-spring-webflux</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-spring-webflux-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-swagger2-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-swagger-common</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-swagger-common-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/springfox-swagger-ui-3.0.0-SNAPSHOT.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>spring</groupId>
            <artifactId>spring-plugin-core</artifactId>
            <version>1.2.0.RELEASE</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/spring-plugin-core-1.2.0.RELEASE.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>spring</groupId>
            <artifactId>spring-plugin-metadata</artifactId>
            <version>1.2.0.RELEASE</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/spring-plugin-metadata-1.2.0.RELEASE.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.5.20</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/swagger-annotations-1.5.20.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>swagger</groupId>
            <artifactId>swagger-models</artifactId>
            <version>1.5.20</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/swagger-models-1.5.20.jar</systemPath>
        </dependency>

lib庫截圖:
SpringCloud Gateway與swagger集成解決方案

springfox提供的快照版本:https://springfox.github.io/springfox/docs/current/#maven
希望swagger官方盡早提供swagger3的release版本。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

云安县| 阜城县| 博野县| 尉氏县| 连城县| 宁武县| 油尖旺区| 大荔县| 襄城县| 清原| 商河县| 滦南县| 南城县| 清水县| 仙居县| 马尔康县| 蛟河市| 项城市| 台北市| 扎赉特旗| 古丈县| 玉门市| 葵青区| 宁晋县| 湘西| 绥棱县| 唐山市| 阿拉尔市| 扎兰屯市| 高平市| 衡水市| 重庆市| 公主岭市| 突泉县| 绥江县| 谷城县| 莫力| 长兴县| 白朗县| 陈巴尔虎旗| 乌什县|