起因 今天在配置swagger文档的时候,出现了访问404的情况。 swagger2配置 1 .添加pom.xml依赖 <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> 2 .编写swaggerConfiguration @Configuration public class SwaggerConfig { //访问http://localhost:8083/swagger-ui.html可以看到API文档 @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHa