pom依赖
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
启动类添加@EnableSwagger2Doc注解
yml配置
swagger:
enabled: true
title: BOOT-TEST API
description: 测试服务 RESTFUL API
version: 1.0.0
base-package: com.test.boot.demo
base-path: /**
exclude-path: /error, /ops/**,/user,/oauth/token,/permission/sync,/resource/sync, /internal/**
控制层类添加@Api(value = "examinationQuestions", tags = "考题设置管理")注解
控制层方法添加@ApiOperation("考题设置-列表查询")注解
控制层方法参数添加@ApiParam(name = "start", value = "分页开始")注解
模型类添加@ApiModel("考题设置对象")注解
模型类的成员添加@ApiModelProperty("标题")注解
swagger访问地址:http://localhost:9022/swagger-ui.html