From c96fbe6b0aeb413a17c429133ee6d81d138144b9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 09 六月 2026 10:58:52 +0800
Subject: [PATCH] Merge branch '1.0' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi into 1.0
---
xp-robotaxi-common/xp-common-core/src/main/java/com/xiaopeng/common/core/utils/ConfigUtils.java | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/xp-robotaxi-common/xp-common-core/src/main/java/com/xiaopeng/common/core/utils/ConfigUtils.java b/xp-robotaxi-common/xp-common-core/src/main/java/com/xiaopeng/common/core/utils/ConfigUtils.java
index b0b1f7f..0252e22 100644
--- a/xp-robotaxi-common/xp-common-core/src/main/java/com/xiaopeng/common/core/utils/ConfigUtils.java
+++ b/xp-robotaxi-common/xp-common-core/src/main/java/com/xiaopeng/common/core/utils/ConfigUtils.java
@@ -1,6 +1,7 @@
package com.xiaopeng.common.core.utils;
+import com.xiaopeng.common.core.constant.TokenConstants;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -9,9 +10,7 @@
@Component
public class ConfigUtils {
-
- // 1. 正常注入非静态字段
- @Value("${token.secret}")
+ @Value("${token.secret:${spring.token.secret:}}")
private String secret;
@@ -19,23 +18,22 @@
@PostConstruct
public void init() {
- System.err.println("ConfigUtils init");
instance = this;
+ TokenConstants.setSecret(secret);
}
- // 3. 提供静态方法供外部调用
- public static String getMyConfigValue() {
+ public static String getTokenSecret() {
if (instance == null) {
- throw new IllegalStateException("ConfigUtils has not been initialized by Spring yet.");
+ return TokenConstants.getSecret();
}
return instance.secret;
}
- // 如果需要修改值,也可以提供静态 setter (视需求而定)
- public static void setMyConfigValue(String value) {
+ public static void setTokenSecret(String value) {
if (instance != null) {
instance.secret = value;
}
+ TokenConstants.setSecret(value);
}
}
--
Gitblit v1.7.1