From c1e858e998661c9210d68b544c9137be5f5b1c86 Mon Sep 17 00:00:00 2001 From: ZQKC Date: Sun, 30 Jun 2024 23:11:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=85=B3=E9=97=ADSwagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- km-console/pom.xml | 4 ++-- .../xiaojukeji/know/streaming/km/rest/config/WebConfig.java | 6 +++++- km-rest/src/main/resources/application.yml | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/km-console/pom.xml b/km-console/pom.xml index 76201e592..eef868e81 100644 --- a/km-console/pom.xml +++ b/km-console/pom.xml @@ -32,8 +32,8 @@ v12.22.12 6.14.16 - https://npm.taobao.org/mirrors/node/ - https://registry.npm.taobao.org/npm/-/ + https://npmmirror.com/mirrors/node/ + https://registry.npmmirror.com/npm/-/ diff --git a/km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/config/WebConfig.java b/km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/config/WebConfig.java index 12f34aa37..7409119e8 100644 --- a/km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/config/WebConfig.java +++ b/km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/config/WebConfig.java @@ -6,6 +6,7 @@ import com.xiaojukeji.know.streaming.km.common.utils.GitPropUtil; import com.xiaojukeji.know.streaming.km.rest.interceptor.PermissionInterceptor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.*; @@ -24,6 +25,9 @@ public class WebConfig implements WebMvcConfigurer { private static final String FE_INDEX_PAGE_HTML = "layout/index"; + @Value(value = "${swagger.enabled:true}") + private Boolean swaggerEnabled; + @Override public void addViewControllers(ViewControllerRegistry registry) { // FE-首页 @@ -69,7 +73,7 @@ public Docket createRestApi() { RequestHandlerSelectors.basePackage("com.didiglobal.logi.security.controller"))) .paths(PathSelectors.any()) .build() - .enable(true); + .enable(swaggerEnabled != null && swaggerEnabled); } private ApiInfo apiInfo() { diff --git a/km-rest/src/main/resources/application.yml b/km-rest/src/main/resources/application.yml index 40152cdda..6a59f4a8c 100644 --- a/km-rest/src/main/resources/application.yml +++ b/km-rest/src/main/resources/application.yml @@ -115,4 +115,7 @@ management: descriptions: true enabled: true tags: - application: know-streaming \ No newline at end of file + application: know-streaming + +swagger: + enabled: true