type
Post
status
Published
date
Mar 21, 2026
slug
summary
tags
category
icon
password
1.介绍
使用Swagger你只需要按照它的规范去定义接口及接口相关的信息,就可以做到生成接口文档,以及在线接口调试页面。
官网:https://swagger.io
Knife4j是为Java MVC框架集成Swagger生成Api文档的增强解决方案。
2.使用方式
- 导入knife4j的maven坐标
- 在配置类中加入knife4j相关配置
- 设置静态资源映射,否则接口文档页面无法访问
3.常用注解
注解 | 说明 |
@Api(tags="") | 用在类上,例如Controller,表示对类的说明 |
@ApiModel(description="") | 用在类上,例如entity,DTO,VO |
@ApiModeProperty("") | 用在属性上,描述属性信息 |
@ApiOperation("") | 用在方法上,例如Controller的方法,说明方法的用途,作用 |
- Author:High
- URL:http://preview.tangly1024.com/article/32a7eb9b-7b98-80aa-9d6f-db7a072d099a
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!



