Get the App
SLTechnology News&Howtos  ›  Servers  › 

Integrated solution of SpringCloud Gateway and swagger

Shulou Source: shulou.com Published: 2022-06-02 19:03:54 10月05日 Update

The bottom layer of spring cloud gateway is that webflux,swagger2 temporarily does not support webflux. Although there are some online solutions, such as this article and "redefining spring cloud practice", the book also has solutions, source code links.

The latest swagger3 snapshot version is integrated in our project. The pom files that need to be introduced are:

Org.springframework.boot spring-boot-starter-integration org.springframework.integration spring-integration-webflux io.springfox springfox-swagger2 3.0.0-SNAPSHOT io.springfox springfox-spring-webflux 3.0.0-SNAPSHOT Io.springfox springfox-spring-integration-webflux 3.0.0-SNAPSHOT io.springfox springfox-swagger-ui 3.0.0-SNAPSHOT ch.qos.logback logback-classic Ch.qos.logback logback-core also needs to introduce the resource library jcenter-snapshots jcenter http://oss.jfrog.org/simple/oss-snapshot-. Local/io/springfox/ false true

Because the company's build system only represents these repositories:

Http://repo1.maven.org/maven2/

Http://jcenter.bintray.com/

Http://repo.grails.org/grails/core/

So although it can be debugged locally, the build fails on the server, and the final solution is to introduce the jar package of swagger3 into the local lib file, and then introduce it into pom to solve the problem. This is a careful work.

Pom file

Classgraph classgraph 4.1.7 system ${basedir} / lib/classgraph-4.1.7.jar classmate classmate 1.4.0 system ${basedir} / lib/classmate-1.4.0.jar mapstruct Mapstruct 1.2.0.Final system ${basedir} / lib/mapstruct-1.2.0.Final.jar rawhttp rawhttp 2.0 system ${basedir} / lib/rawhttp-core-2.0.jar springfox springfox 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-core-3.0.0-SNAPSHOT.jar springfox springfox-schema 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-schema-3.0.0-SNAPSHOT.jar springfox Springfox-spi 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-spi-3.0.0-SNAPSHOT.jar springfox springfox-spring-integration 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-spring-integration-3.0.0-SNAPSHOT.jar Springfox springfox-spring-integration-webflux 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-spring-integration-webflux-3.0.0-SNAPSHOT.jar springfox springfox-spring-web 3.0.0-SNAPSHOT system $ {basedir} / lib/springfox-spring-web-3.0.0-SNAPSHOT.jar springfox springfox-spring-webflux 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-spring-webflux-3.0.0-SNAPSHOT.jar springfox springfox-swagger2 3.0 .0-SNAPSHOT system ${basedir} / lib/springfox-swagger2-3.0.0-SNAPSHOT.jar springfox springfox-swagger-common 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-swagger-common-3.0.0-SNAPSHOT.jar springfox Springfox-swagger-ui 3.0.0-SNAPSHOT system ${basedir} / lib/springfox-swagger-ui-3.0.0-SNAPSHOT.jar spring spring-plugin-core 1.2.0.RELEASE system ${basedir} / lib/spring-plugin-core-1.2.0.RELEASE .jar spring spring-plugin-metadata 1.2.0.RELEASE system ${basedir} / lib/spring-plugin-metadata-1.2.0.RELEASE.jar swagger swagger-annotations 1.5.20 system ${basedir} / lib / swagger-annotations-1.5.20.jar swagger swagger-models 1.5.20 system ${basedir} / lib/swagger-models-1.5.20.jar

Screenshot of lib library:

Snapshot version provided by springfox: https://springfox.github.io/springfox/docs/current/#maven

It is hoped that swagger officials will provide the release version of swagger3 as soon as possible.

Tags: Solution file version solution careful book source warehouse company official actual combat bottom layer snapshot screenshot server article system outcome resource resource repository this is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Redmi Shulou Technology MySQL vpn