当前位置:   article > 正文

Springboot3+Springdoc2(swagger3)+gateway微服务聚合

Springboot3+Springdoc2(swagger3)+gateway微服务聚合

配置springdoc_springdoc-openapi-starter-webmvc-api-CSDN博客

注意注意注意,存在bug,在运行其他微服务的时候自行在接口前面拼接前缀

0: 依赖 springboot3之后,jakarta包代替javax,并且gateway使用webflux代替webmvc

  1. //原始版本
  2. <!-- <dependency>-->
  3. <!-- <groupId>org.springdoc</groupId>-->
  4. <!-- <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>-->
  5. <springdoc-openapi.version>2.3.0</springdoc-openapi.version>
  6. <!-- </dependency>-->
  7. //增强版
  8. <dependency>
  9. <groupId>com.github.xiaoymin</groupId>
  10. <artifactId>knife4j-openapi3-webflux-jakarta-spring-boot-starter</artifactId>
  11. <version>4.5.0</version>
  12. </dependency>

1: yml

  1. springdoc:
  2. swagger-ui:
  3. urls:
  4. - name: gateway
  5. url: /v3/api-docs
  6. - name: xxx
  7. url: /v3/api-docs/xxx

2: gateway

  1. routes:
  2. - id: openapi
  3. uri: http://localhost:${server.port}
  4. predicates:
  5. - Path=/v3/api-docs/**
  6. filters:
  7. - RewritePath=/v3/api-docs/(?<path>.*), /$\{path}/v3/api-docs

3:config

4:打开

    原Swagger文档:         http://localhost:0000/swagger-ui.html
    knife4j文档:         http://localhost:0000/doc.html

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号