发布时间:2022-08-09 文章分类:编程知识 投稿人:王小丽 字号: 默认 | | 超大 打印

A.2.2.5.<util:map/>

Before...

<!-- creates a java.util.Map instance with values loaded from the supplied 'sourceMap' -->
<bean id="emails" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="pechorin" value="pechorin@hero.org"/>
<entry key="raskolnikov" value="raskolnikov@slums.org"/>
<entry key="stavrogin" value="stavrogin@gov.org"/>
<entry key="porfiry" value="porfiry@gov.org"/>
</map>
</property>
</bean>

关于异或的用法

boolean hasResultKey = StringUtils.isNotEmpty(resultKey);
boolean hasParamList = !CollectionUtils.isEmpty(paramList);

if (hasResultKey ^ hasParamList) {
throw new Exception(
"xxxx");
}