From c9d8c6a421fb30fa36af946535699451bd693ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Sat, 20 Jul 2024 15:51:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(common-core):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E9=85=8D=E7=BD=AE=20common-config=20,=20?= =?UTF-8?q?=E7=AE=80=E5=8C=96=20application=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 大部分情况下 common-config 一旦确定后续不修改,所以不需要写在 application 做一个简化 (cherry picked from commit 56f4b2fb915f3552e83ed4760772b13942ebd4d6) --- .../src/main/resources/application-dev.yml | 9 +++---- .../core/config/ImmutableConfiguration.java | 14 ++++++++++ .../src/main/resources/common-config.yml | 26 +++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/ImmutableConfiguration.java create mode 100644 pigx-common/pigx-common-core/src/main/resources/common-config.yml diff --git a/pigx-boot/src/main/resources/application-dev.yml b/pigx-boot/src/main/resources/application-dev.yml index 1e2509991..084ecbf68 100644 --- a/pigx-boot/src/main/resources/application-dev.yml +++ b/pigx-boot/src/main/resources/application-dev.yml @@ -22,18 +22,17 @@ file: aj: captcha: water-mark: pig4cloud - cache-type: redis + +# 登录报文加密根密钥 ,必须是16位 security: - # 登录报文加密根密钥 ,必须是16位 encodeKey: pigxpigxpigxpigx # 配置文件加密根密码 jasypt: encryptor: password: pigx - algorithm: PBEWithMD5AndDES - iv-generator-classname: org.jasypt.iv.NoIvGenerator -# swagger 配置 +# swagger token url 配置 swagger: token-url: ${swagger.gateway}/admin/oauth2/token + diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/ImmutableConfiguration.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/ImmutableConfiguration.java new file mode 100644 index 000000000..93e9be0ee --- /dev/null +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/config/ImmutableConfiguration.java @@ -0,0 +1,14 @@ +package com.pig4cloud.pigx.common.core.config; + +import com.pig4cloud.pigx.common.core.factory.YamlPropertySourceFactory; +import org.springframework.context.annotation.PropertySource; + +/** + * 加载不可变配置项,这样的配置文件一舦是放在jar包中的,不会随着环境的变化而变化。 + * + * @author lengleng + * @date 2024/7/20 + */ +@PropertySource(value = "classpath:common-config.yml", factory = YamlPropertySourceFactory.class) +public class ImmutableConfiguration { +} diff --git a/pigx-common/pigx-common-core/src/main/resources/common-config.yml b/pigx-common/pigx-common-core/src/main/resources/common-config.yml new file mode 100644 index 000000000..e32288c16 --- /dev/null +++ b/pigx-common/pigx-common-core/src/main/resources/common-config.yml @@ -0,0 +1,26 @@ +# 很多第三方组件的配置默认值一般均不需要改动,写在nacos 中比较混乱冗余,就可以写在此处 + +# sms4j配置 +sms: + is-print: false + config-type: interface +sms-oa: + config-type: yaml + +# 行为验证码配置 +aj: + captcha: + cache-type: redis + +# 配置文件加密方法 +jasypt: + encryptor: + algorithm: PBEWithMD5AndDES + iv-generator-classname: org.jasypt.iv.NoIvGenerator + +# liteflow配置 +liteflow: + rule-source: rules/*-rule.xml + print-banner: false + print-execution-log: false + enable: true