From c16ee7fc2c6cbda1cc8e87f21f1c29b2cb5948cd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 8 Jun 2021 16:34:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7swagger=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=ACv3.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 41 +++++++------------ ruoyi-admin/pom.xml | 20 ++------- .../ruoyi/web/core/config/SwaggerConfig.java | 12 +++--- ruoyi-ui/src/components/Editor/index.vue | 1 - ruoyi-ui/src/views/tool/swagger/index.vue | 2 +- 5 files changed, 25 insertions(+), 51 deletions(-) diff --git a/pom.xml b/pom.xml index 640387a..ebf3f28 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 3.1.1 1.2.6 1.21 - 2.9.2 + 3.0.0 2.3.2 2.1.4 1.3.0 @@ -48,7 +48,7 @@ import - + com.alibaba druid-spring-boot-starter @@ -95,38 +95,25 @@ ${jna.version} - + io.springfox - springfox-swagger2 - ${swagger.version} - - - io.swagger - swagger-annotations - - - io.swagger - swagger-models - - - - - - - io.springfox - springfox-swagger-ui - ${swagger.version} + springfox-boot-starter + 3.0.0 + + io.swagger + swagger-models + - + commons-io commons-io ${commons.io.version} - + commons-fileupload commons-fileupload @@ -140,7 +127,7 @@ ${poi.version} - + org.apache.velocity velocity @@ -167,14 +154,14 @@ ${fastjson.version} - + io.jsonwebtoken jjwt ${jwt.version} - + com.github.penggle kaptcha diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index d58ad5b..25016b0 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -24,29 +24,17 @@ true - + io.springfox - springfox-swagger2 - - - - - io.swagger - swagger-annotations - 1.5.21 + springfox-boot-starter + io.swagger swagger-models - 1.5.21 - - - - - io.springfox - springfox-swagger-ui + 1.6.2 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 86acc3f..02227fd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.ruoyi.common.config.RuoYiConfig; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; @@ -16,10 +17,10 @@ import springfox.documentation.service.ApiKey; import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.Contact; import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; 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; /** * Swagger2的接口配置 @@ -27,7 +28,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; * @author ruoyi */ @Configuration -@EnableSwagger2 public class SwaggerConfig { /** 系统基础配置 */ @@ -71,10 +71,10 @@ public class SwaggerConfig /** * 安全模式,这里指定token通过Authorization头请求头传递 */ - private List securitySchemes() + private List securitySchemes() { - List apiKeyList = new ArrayList(); - apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); return apiKeyList; } @@ -87,7 +87,7 @@ public class SwaggerConfig securityContexts.add( SecurityContext.builder() .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!auth).*$")) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) .build()); return securityContexts; } diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue index ad4da7e..d63a48d 100644 --- a/ruoyi-ui/src/components/Editor/index.vue +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -158,7 +158,6 @@ export default { }); }, handleUploadSuccess(res, file) { - console.info(file); // 获取富文本组件实例 let quill = this.Quill; // 如果上传成功 diff --git a/ruoyi-ui/src/views/tool/swagger/index.vue b/ruoyi-ui/src/views/tool/swagger/index.vue index 624b59a..8db3180 100644 --- a/ruoyi-ui/src/views/tool/swagger/index.vue +++ b/ruoyi-ui/src/views/tool/swagger/index.vue @@ -8,7 +8,7 @@ export default { name: "Swagger", data() { return { - src: process.env.VUE_APP_BASE_API + "/swagger-ui.html", + src: process.env.VUE_APP_BASE_API + "/swagger-ui/index.html", height: document.documentElement.clientHeight - 94.5 + "px;", loading: true };