Spring Boot 3.x使用knife4j
1.添加knife4j依赖
 
<dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId><version>4.4.0</version>
</dependency>
2.在application.yml文件中配置属性
 
# springdoc-openapi项目配置
springdoc:swagger-ui:path: /swagger-ui.htmltags-sorter: alphaoperations-sorter: alphaapi-docs:path: /v3/api-docsgroup-configs:- group: 'default'paths-to-match: '/**'packages-to-scan: com.xxx.xxx.controller    #这里换成你模块下controller包的路径# knife4j的增强配置,不需要增强可以不配(建议配置一下)
knife4j:enable: truesetting:language: zh_cn
3.端口异常添加
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
4.访问
http://localhost:端口号/doc.html
http://localhost:端口号/swagger-ui/index.html

 
 自定义接口描述
@Tag(name = "用户管理", description = "用户管理相关接口")
@Operation(summary = "用户登录", description = "用户登录接口")