解决rdb下有多个配制,会导致配置相互覆盖的问题 (#4560)

恩baseProperties这个变量是共享的,不能修改这个变量的属性值。要不后续的配置都会改变。关联issue为4355
This commit is contained in:
weirhp
2023-09-04 17:23:26 +08:00
committed by GitHub
parent 5ea9259f0d
commit d623bea71a

View File

@@ -73,6 +73,9 @@ public class YamlUtils {
PropertySource<?> propertySource = propertySources.get(0);
Properties properties = new Properties();
if (baseProperties != null) {
properties.putAll(baseProperties);
}
properties.putAll((Map<?, ?>) propertySource.getSource());
@@ -82,12 +85,7 @@ public class YamlUtils {
entry.setValue(((OriginTrackedValue) value).getValue());
}
}
if (baseProperties != null) {
baseProperties.putAll(properties);
properties = baseProperties;
}
ConfigurationPropertySource sources = new MapConfigurationPropertySource(properties);
Binder binder = new Binder(sources);
return binder.bind(prefix, Bindable.of(clazz)).get();