From 13fb4015778d5b2ca047b2cd74c69cf193684b57 Mon Sep 17 00:00:00 2001 From: shedfreewu <49236872+shedfreewu@users.noreply.github.com> Date: Tue, 8 Jul 2025 17:22:57 +0800 Subject: [PATCH] fix: The repeated creation of PolarisPropertySourceManager results in the failure of configuration refresh. (#1643) --- CHANGELOG.md | 1 + pom.xml | 2 +- .../polaris/config/adapter/PolarisPropertySourceManager.java | 4 ++-- spring-cloud-tencent-dependencies/pom.xml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28dcb3f02..5bd31aed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,3 +26,4 @@ - fix:fix restTemplateCustomizer bean conflict causing service to fail to start properly. - fix:fix NullPointerException when properties contain kv with null value. - fix: upgrade polaris java to 1.15.8 +- [fix: The repeated creation of PolarisPropertySourceManager results in the failure of configuration refresh.](https://github.com/Tencent/spring-cloud-tencent/pull/1643) diff --git a/pom.xml b/pom.xml index 52f9c6a6f..d307e02b9 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ - 1.13.3-2021.0.9 + 1.13.4-2021.0.9 5.3.31 diff --git a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisPropertySourceManager.java b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisPropertySourceManager.java index f8736e20e..16bc7a975 100644 --- a/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisPropertySourceManager.java +++ b/spring-cloud-starter-tencent-polaris-config/src/main/java/com/tencent/cloud/polaris/config/adapter/PolarisPropertySourceManager.java @@ -30,10 +30,10 @@ import java.util.concurrent.ConcurrentHashMap; */ public class PolarisPropertySourceManager { - private final Map polarisPropertySources = new ConcurrentHashMap<>(); + private static final Map polarisPropertySources = new ConcurrentHashMap<>(); public void addPropertySource(PolarisPropertySource polarisPropertySource) { - polarisPropertySources.putIfAbsent(polarisPropertySource.getPropertySourceName(), polarisPropertySource); + polarisPropertySources.put(polarisPropertySource.getPropertySourceName(), polarisPropertySource); } public List getAllPropertySources() { diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml index 962c0c0a5..f61ad9f44 100644 --- a/spring-cloud-tencent-dependencies/pom.xml +++ b/spring-cloud-tencent-dependencies/pom.xml @@ -70,7 +70,7 @@ - 1.13.3-2021.0.9 + 1.13.4-2021.0.9 1.15.8