首选引入pom依赖
<!-- swagger2 -->
<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>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.0</version>
</dependency>
其实swagger2官方文档已经很清晰的告诉我们该怎样去创建一个api实例,而作为java程序员最基础的开发规范就包括了减少代码冗余,官方原本的api实例构造繁琐,而一个项目中的接口通常又以业务模块划分肯定会不少,只需查看一下swagger源码抽出公共部分的创建方式即可
package com.youxue.my.timeTask.swagger;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import com.google.common.base.Predicate;
import org.springframework.beans.factory.annotation.