一、在pom.xml中添加依赖
<!-- swagger start-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<!-- 解决FluentIterable.class找不到问题 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<!-- swagger end-->
二、编写配置类
配置类需要使用@Configration
注解和@EnableSwagger2
注解。
具体的配置类可以参看如下代码
package com.example.wl.config;
import io.swagger.annotations.ApiOperation;
import org.springframework