检查依赖文件中的依赖是否导全,博主是少了一个swagger注解依赖才爆红的
<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>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> <version>1.5.19</version> </dependency> @Configuration @EnableSwagger2//开启Swagger2 public class SwaggerConfig { }