This is an automated email from the ASF dual-hosted git repository. jianbin pushed a commit to branch 2.x in repository https://gitbox.apache.org/repos/asf/incubator-seata.git
The following commit(s) were added to refs/heads/2.x by this push: new 4a03548add bugfix:fix the compatibility issue of yml configuration files (#7624) 4a03548add is described below commit 4a03548add73288d510b3b43184e01e1ba52abc7 Author: xiaoyu <93440108+yvce...@users.noreply.github.com> AuthorDate: Mon Sep 8 11:27:05 2025 +0800 bugfix:fix the compatibility issue of yml configuration files (#7624) --- changes/en-us/2.x.md | 1 + changes/zh-cn/2.x.md | 1 + .../main/java/org/apache/seata/config/processor/ProcessorYaml.java | 7 ++++++- .../java/org/apache/seata/config/processor/ProcessorYamlTest.java | 3 +-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md index 0058d3c60d..528a9cc446 100644 --- a/changes/en-us/2.x.md +++ b/changes/en-us/2.x.md @@ -35,6 +35,7 @@ Add changes here for all PR submitted to the 2.x branch. - [[#7568](https://github.com/apache/incubator-seata/pull/7568)] Fix order() behavior in GlobalTransactionalInterceptorHandler to ensure correct sorting of invocation handlers - [[#7596](https://github.com/apache/incubator-seata/pull/7596)] Fixed the issue where deserialization failed when the xss filter obtained the default keyword - [[#7613](https://github.com/apache/incubator-seata/pull/7613)] Fixed the SQL error in the datetime format time query in the global lock query +- [[#7624](https://github.com/apache/incubator-seata/pull/7624)] fix the compatibility issue of yml configuration files diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index 45ba533167..c554583c69 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -36,6 +36,7 @@ - [[#7568](https://github.com/apache/incubator-seata/pull/7568)] 修复 GlobalTransactionalInterceptorHandler 中的 order() 方法行为,确保拦截器的正确排序 - [[#7596](https://github.com/apache/incubator-seata/pull/7596)] 修复xss过滤器获取默认关键字时反序列化失败的问题 - [[#7613](https://github.com/apache/incubator-seata/pull/7613)] 修复全局锁查询中的datetime时间格式时间查询sql错误 +- [[#7624](https://github.com/apache/incubator-seata/pull/7624)] 修复yml配置文件中对于整数的兼容问题 ### optimize: diff --git a/config/seata-config-core/src/main/java/org/apache/seata/config/processor/ProcessorYaml.java b/config/seata-config-core/src/main/java/org/apache/seata/config/processor/ProcessorYaml.java index 9ee3015a46..0d0a667d89 100644 --- a/config/seata-config-core/src/main/java/org/apache/seata/config/processor/ProcessorYaml.java +++ b/config/seata-config-core/src/main/java/org/apache/seata/config/processor/ProcessorYaml.java @@ -22,6 +22,7 @@ import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; @@ -36,7 +37,11 @@ public class ProcessorYaml implements Processor { public Properties processor(String config) { Properties properties = new Properties(); Map<String, Object> configMap = MapUtil.asMap(new Yaml(new SafeConstructor(new LoaderOptions())).load(config)); - properties.putAll(MapUtil.getFlattenedMap(configMap)); + Map<String, String> stringConfigMap = new LinkedHashMap<>(); + MapUtil.getFlattenedMap(configMap).forEach((k, v) -> { + stringConfigMap.put(k, v == null ? null : String.valueOf(v)); + }); + properties.putAll(stringConfigMap); return properties; } } diff --git a/config/seata-config-core/src/test/java/org/apache/seata/config/processor/ProcessorYamlTest.java b/config/seata-config-core/src/test/java/org/apache/seata/config/processor/ProcessorYamlTest.java index cb63334a18..45f9927e52 100644 --- a/config/seata-config-core/src/test/java/org/apache/seata/config/processor/ProcessorYamlTest.java +++ b/config/seata-config-core/src/test/java/org/apache/seata/config/processor/ProcessorYamlTest.java @@ -38,8 +38,7 @@ public class ProcessorYamlTest { ProcessorYaml processorYaml = new ProcessorYaml(); Properties props = processorYaml.processor(yamlConfig); - assertEquals(8080, props.get("server.port")); - assertEquals("", props.getProperty("server.port", "")); + assertEquals("8080", props.getProperty("server.port", "")); assertEquals("localhost", props.getProperty("server.host")); assertEquals("jdbc:mysql://localhost:3306/test", props.getProperty("spring.datasource.url")); assertEquals("root", props.getProperty("spring.datasource.username")); --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org