一,在pom文件里导入swagger的依赖坐标
<!--swagger-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.1.0</version>
</dependency>
<!--web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
二,然后需要配置swagger信息:
knife4j:
enable: true
openapi:
title: 用户管理接口文档
description: "用户管理接口文档"
email: bestwishesn@163.com
concat: bestwishes
url: https://www.itcast.cn
version: v1.0.0
group:
default:
group-name: default
api-rule: package
api-rule-resources:
- com.itheima.mp.controller
三,注解
@ApiModel(description = "用户表单实体")
@ApiModelProperty("id")
@Api(tags = "用户管理接口")
@ApiOperation("新增用户")
@Param("id")