升级swagger到最新版本v3.0.0

This commit is contained in:
RuoYi 2021-06-09 20:07:36 +08:00
parent c16ee7fc2c
commit 2ace3257f9
3 changed files with 9 additions and 8 deletions

12
pom.xml
View File

@ -99,11 +99,13 @@
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId> <artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version> <version>${swagger.version}</version>
<exclusion> <exclusions>
<groupId>io.swagger</groupId> <exclusion>
<artifactId>swagger-models</artifactId> <groupId>io.swagger</groupId>
</exclusion> <artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- io常用工具类 --> <!-- io常用工具类 -->

View File

@ -48,7 +48,7 @@ public class SwaggerConfig
@Bean @Bean
public Docket createRestApi() public Docket createRestApi()
{ {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger // 是否启用Swagger
.enable(enabled) .enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息 // 用来创建该API的基本信息展示在文档的页面中自定义展示的信息

View File

@ -31,8 +31,7 @@ public class ResourcesConfig implements WebMvcConfigurer
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
/** swagger配置 */ /** swagger配置 */
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
} }
/** /**