From b47e5d4c5d6e4c7dd4019634b7c261c2d6e3e04d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 25 Jun 2022 11:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91`yudao.erro?= =?UTF-8?q?r-code.enable`=20=E9=94=99=E8=AF=AF=E7=A0=81=E7=9A=84=E5=BC=80?= =?UTF-8?q?=E5=85=B3=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=9C=A8=20`local`=20?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=85=B3=E9=97=AD=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/errorcode/config/ErrorCodeProperties.java | 4 ++++ .../errorcode/config/YudaoErrorCodeAutoConfiguration.java | 2 ++ .../src/main/resources/application-local.yaml | 2 ++ .../src/main/resources/application-local.yaml | 2 ++ 4 files changed, 10 insertions(+) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/ErrorCodeProperties.java b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/ErrorCodeProperties.java index cc2e1c5c..1c1d1b8a 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/ErrorCodeProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/ErrorCodeProperties.java @@ -17,6 +17,10 @@ import java.util.List; @Validated public class ErrorCodeProperties { + /** + * 是否开启 + */ + private Boolean enable = true; /** * 错误码枚举类 */ diff --git a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/YudaoErrorCodeAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/YudaoErrorCodeAutoConfiguration.java index 42357341..f28d8d95 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/YudaoErrorCodeAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/YudaoErrorCodeAutoConfiguration.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.errorcode.core.loader.ErrorCodeLoader; import cn.iocoder.yudao.framework.errorcode.core.loader.ErrorCodeLoaderImpl; import cn.iocoder.yudao.module.system.api.errorcode.ErrorCodeApi; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; * @author 芋道源码 */ @Configuration +@ConditionalOnProperty(prefix = "yudao.error-code", value = "enable", matchIfMissing = true) // 允许使用 yudao.error-code.enable=false 禁用访问日志 @EnableConfigurationProperties(ErrorCodeProperties.class) @EnableScheduling // 开启调度任务的功能,因为 ErrorCodeRemoteLoader 通过定时刷新错误码 public class YudaoErrorCodeAutoConfiguration { diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml index fd546df7..83f0f2a1 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml @@ -136,4 +136,6 @@ yudao: - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 access-log: # 访问日志的配置项 enable: false + error-code: # 错误码相关配置项 + enable: false demo: false # 关闭演示模式 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml index 1d6c8f8a..8895240b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml @@ -152,6 +152,8 @@ yudao: refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify access-log: # 访问日志的配置项 enable: false + error-code: # 错误码相关配置项 + enable: false demo: false # 关闭演示模式 justauth: