代码拉取完成,页面将自动刷新
同步操作将从 huifer/Code-Analysis 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
类全路径: org.springframework.beans.factory.support.ManagedProperties
类图:
对应标签 <props>
<props>
<prop key="administrator">administrator@example.org</prop>
<prop key="support">support@example.org</prop>
<prop key="development">development@example.org</prop>
</props>
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate#parsePropsElement
这里不做具体展开回到ManagedProperties
类上, 一些get&set
方法忽略, 这里对 merge
方法进行分析
ManagedProperties
作为Mergeable
的实现类, 其操作的对象为Properties
, 想到合并可以联想到 Properties#putAll
=>java.util.Hashtable#putAll
Spring 中也正是如此进行操作的. 详细代码如下@Override
public Object merge(@Nullable Object parent) {
// 是否允许合并
if (!this.mergeEnabled) {
throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'");
}
// 入参为空, 直接返回自己
if (parent == null) {
return this;
}
// 判断入参是否时 Properties
if (!(parent instanceof Properties)) {
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
}
// 创建 Properties , 通过两次 putAll 将数据填充返回
Properties merged = new ManagedProperties();
merged.putAll((Properties) parent);
merged.putAll(this);
return merged;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。