swagger下面版本无论访问:http://localhost:8080/swagger-ui.html还是http://localhost:8080/swagger-ui/index.html都报404
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
@Configuration //配置类
@EnableSwagger2// 开启Swagger2的自动配置
public class MySwaggerConfig {
}
方案一:降版本
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
@Configuration //配置类
@EnableSwagger2// 开启Swagger2的自动配置
public class MySwaggerConfig {
}
访问:http://localhost:8080/swagger-ui.html
方案二:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
@Configuration //配置类
@EnableOpenApi
public class MySwaggerConfig {
}
访问:http://localhost:8080/swagger-ui/index.html