<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${org.springdoc.version}</version>
</dependency>
Swagger版本要与springboot 版本对应
2.1.0 ->3.1.2
<org.springdoc.version>2.1.0</org.springdoc.version>
地址:http://localhost:8090/swagger-ui/index.html
增强版
swagger扩展框架 之knife4j
<knife4j.version>4.3.0</knife4j.version>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
地址:http://localhost:8090/doc.html#/home
配置
# springdoc-openapi项目配置
springdoc:
swagger-ui:
path: /swagger-ui.html
tags-sorter: alpha
operations-sorter: alpha
api-docs:
path: /v3/api-docs
group-configs:
- group: 'default'
paths-to-match: '/**'
packages-to-scan: com.example.activiti.controller
# knife4j的增强配置,不需要增强可以不配
knife4j:
enable: true
setting:
language: en
Knife4j · 集Swagger2及OpenAPI3为一体的增强解决方案. | Knife4j (xiaominfo.com)