From b24e0d2682f01896c8751e212a8a32095244f2b9 Mon Sep 17 00:00:00 2001 From: tjq Date: Sat, 6 Feb 2021 16:01:56 +0800 Subject: [PATCH] feat: support disable swagger-ui by config #203 --- .../powerjob/server/common/PowerJobServerConfigKey.java | 4 ++++ .../kfcfans/powerjob/server/common/config/SwaggerConfig.java | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/PowerJobServerConfigKey.java b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/PowerJobServerConfigKey.java index c31f748f..5097a152 100644 --- a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/PowerJobServerConfigKey.java +++ b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/PowerJobServerConfigKey.java @@ -20,6 +20,10 @@ public class PowerJobServerConfigKey { * 是否使用 mongoDB */ public static final String MONGODB_ENABLE = "oms.mongodb.enable"; + /** + * 是否启用 Swagger-UI,默认关闭 + */ + public static final String SWAGGER_UI_ENABLE = "oms.swagger.enable"; /** * 钉钉报警相关 diff --git a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/config/SwaggerConfig.java b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/config/SwaggerConfig.java index 65dea927..e32bea84 100644 --- a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/config/SwaggerConfig.java +++ b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/common/config/SwaggerConfig.java @@ -1,5 +1,6 @@ package com.github.kfcfans.powerjob.server.common.config; +import com.github.kfcfans.powerjob.server.common.PowerJobServerConfigKey; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -23,7 +24,7 @@ import static springfox.documentation.builders.PathSelectors.any; */ @Configuration @EnableSwagger2 -@ConditionalOnProperty(name = "oms.swagger.enable", havingValue = "true") +@ConditionalOnProperty(name = PowerJobServerConfigKey.SWAGGER_UI_ENABLE, havingValue = "true") public class SwaggerConfig { private final BuildProperties buildProperties;