1.首先在pom文件中添加如下依赖

<!--生成数据-->
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>
	<version>2.7.0</version>
</dependency>
<!--生成文档-->
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.7.0</version>
</dependency>

2.在启动类上加上 @EnableSwagger2

3.启动项目,访问http://localhost:8082/reed/swagger-ui.html,将会列出系统中所有的controller

---------

一些技巧

1.在方法前面加上

@ApiOperation(value = "查询部门所有信息"),则表明此方法的作用为查询部门所有信息,效果如下图

2.给封装的查询条件加注释,如下图

效果如下图所示

 

对未封装的属性加注释

效果如下图

----