一. 创建一个swagger
1.springboot的pom.xml中导入依赖:
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<!--swagger ui-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
2.在config包下,创建Swagger2Config类:
两个注解非常重要:@Configuration和EnableSwagger2