Springboot3+Springdoc2(swagger3)+gateway微服务聚合
配置springdoc_springdoc-openapi-starter-webmvc-api-CSDN博客
注意注意注意,存在bug,在运行其他微服务的时候自行在接口前面拼接前缀
0: 依赖 springboot3之后,jakarta包代替javax,并且gateway使用webflux代替webmvc
//原始版本
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>-->
<springdoc-openapi.version>2.3.0</springdoc-openapi.version>
<!-- </dependency>-->
//增强版
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-webflux-jakarta-spring-boot-starter</artifactId>
<version>4.5.0</version>
</dependency>
1: yml
springdoc:
swagger-ui:
urls:
- name: gateway
url: /v3/api-docs
- name: xxx
url: /v3/api-docs/xxx
2: gateway
routes:
- id: openapi
uri: http://localhost:${server.port}
predicates:
- Path=/v3/api-docs/**
filters:
- 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