Skip to content

Commit cecda46

Browse files
weirhpzoemak
authored andcommitted
解决rdb下有多个配制,会导致配置相互覆盖的问题 (alibaba#4560)
恩baseProperties这个变量是共享的,不能修改这个变量的属性值。要不后续的配置都会改变。关联issue为4355
1 parent 3ffa2e8 commit cecda46

File tree

1 file changed

+4
-6
lines changed
  • client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support

1 file changed

+4
-6
lines changed

client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/YamlUtils.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public static <T> T ymlToObj(String prefix, String content, Class<T> clazz, Stri
7373
PropertySource<?> propertySource = propertySources.get(0);
7474

7575
Properties properties = new Properties();
76+
if (baseProperties != null) {
77+
properties.putAll(baseProperties);
78+
}
7679

7780
properties.putAll((Map<?, ?>) propertySource.getSource());
7881

@@ -82,12 +85,7 @@ public static <T> T ymlToObj(String prefix, String content, Class<T> clazz, Stri
8285
entry.setValue(((OriginTrackedValue) value).getValue());
8386
}
8487
}
85-
86-
if (baseProperties != null) {
87-
baseProperties.putAll(properties);
88-
properties = baseProperties;
89-
}
90-
88+
9189
ConfigurationPropertySource sources = new MapConfigurationPropertySource(properties);
9290
Binder binder = new Binder(sources);
9391
return binder.bind(prefix, Bindable.of(clazz)).get();

0 commit comments

Comments
 (0)