From 524683eabdef0ec4a58e653c94063bf5d51d8e99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?=
<15040126243@163.com>
Date: Thu, 10 Jun 2021 09:57:34 +0800
Subject: [PATCH] =?UTF-8?q?update=20swagger=20=E5=8D=87=E7=BA=A7=E4=B8=BA?=
=?UTF-8?q?=203.0.0=20=E4=BD=BF=E7=94=A8=20OAS=5F30=20=E5=8D=8F=E8=AE=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 13 -------------
ruoyi-common/pom.xml | 5 -----
.../com/ruoyi/framework/config/SwaggerConfig.java | 9 ++++-----
3 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6c2b99e6..94ab8d5c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,6 @@
3.1.1
1.2.6
3.0.2
- 1.5.22
1.2.76
4.1.2
1.7
@@ -58,18 +57,6 @@
com.github.xiaoymin
knife4j-spring-boot-starter
${knife4j.version}
-
-
- swagger-annotations
- io.swagger
-
-
-
-
-
- io.swagger
- swagger-annotations
- ${swagger-annotations.version}
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index 2c75fcd1..c6275c25 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -136,11 +136,6 @@
knife4j-spring-boot-starter
-
- io.swagger
- swagger-annotations
-
-
org.springframework.boot
spring-boot-starter-actuator
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java
index 1a92ca08..7b5d9510 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java
@@ -3,6 +3,7 @@ package com.ruoyi.framework.config;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import com.ruoyi.framework.config.properties.SwaggerProperties;
import io.swagger.annotations.ApiOperation;
+import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,7 +14,6 @@ import springfox.documentation.service.*;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
@@ -24,7 +24,6 @@ import java.util.List;
* @author Lion Li
*/
@Configuration
-@EnableSwagger2
@EnableKnife4j
public class SwaggerConfig {
@@ -36,7 +35,7 @@ public class SwaggerConfig {
*/
@Bean
public Docket createRestApi() {
- return new Docket(DocumentationType.SWAGGER_2)
+ return new Docket(DocumentationType.OAS_30)
.enable(swaggerProperties.getEnabled())
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
.apiInfo(apiInfo())
@@ -60,7 +59,7 @@ public class SwaggerConfig {
*/
private List securitySchemes() {
List apiKeyList = new ArrayList();
- apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
+ apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList;
}
@@ -72,7 +71,7 @@ public class SwaggerConfig {
securityContexts.add(
SecurityContext.builder()
.securityReferences(defaultAuth())
- .forPaths(PathSelectors.regex("^(?!auth).*$"))
+ .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
.build());
return securityContexts;
}