From 69c2a41dd228a8dda7c5449c0579d677d409dcd0 Mon Sep 17 00:00:00 2001 From: chenxing Date: Wed, 9 Sep 2026 11:27:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=20PropertyEnvCon?= =?UTF-8?q?figSource=EF=BC=8Cenv-config=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E7=94=B1=E5=B9=B3=E5=8F=B0=E9=BB=98=E8=AE=A4=E6=8C=82=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=BA=90=E5=85=9C=E5=BA=95=EF=BC=88yh-env-co?= =?UTF-8?q?nfig=20starter=20B2=20=E4=B8=8B=E6=B2=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/PropertyEnvConfigSource.java | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/main/java/com/yunhai/notice/config/PropertyEnvConfigSource.java diff --git a/src/main/java/com/yunhai/notice/config/PropertyEnvConfigSource.java b/src/main/java/com/yunhai/notice/config/PropertyEnvConfigSource.java deleted file mode 100644 index 1bcd622..0000000 --- a/src/main/java/com/yunhai/notice/config/PropertyEnvConfigSource.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.yunhai.notice.config; - -import com.yunhai.platform.envconfig.EnvConfigSource; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Service; - -/** - * env-config 数据源实现:从 Spring Environment 读取通知公告前端目标的运行时配置 JSON。 - * 键 = {@code yh.env-config.source.}(前端 SPA 部署于 /{contextPath}/front/,target 即 front), - * 三处可配(优先级由 Environment 决定): - * 1) 启动参数 --yh.env-config.source.front='{...}' - * 2) 环境变量 YH_ENV_CONFIG_SOURCE_FRONT(projman 配置管理注入,宽松绑定) - * 3) application.yml / Nacos notice.yaml 内 yh.env-config.source.front 键 - * 未配置返回 null,平台 EnvConfigService 归一为 "{}" 返回(前端走同域推导兜底,接口恒 200)。 - * - *

存在本 bean 即满足 {@code yh-env-config-spring-boot-starter} 的自动装配条件(聚合 starter 已携带该模块), - * 自动注册免登录 {@code GET /api/env-config?target=front}:EnvConfigSsoBypassFilter(HIGHEST+3) - * 抢在 yh-auth 的 CAS 过滤链(yh.sso.url-pattern=/api/*,HIGHEST+4 起)之前 forward 旁路,SPA 登录前可拉。 - */ -@Service -public class PropertyEnvConfigSource implements EnvConfigSource { - - private static final String KEY_PREFIX = "yh.env-config.source."; - - private final Environment environment; - - public PropertyEnvConfigSource(Environment environment) { - this.environment = environment; - } - - @Override - public String get(String target) { - return environment.getProperty(KEY_PREFIX + target); - } -}