3
我想在我的Spring bean XML来定义一个枚举映射,我希望它在XML填充,但是当我尝试定义它像这样定义枚举地图
<bean class = "java.util.EnumMap">
<constructor-arg>
<util:map key-type="org.itemlist.products.stockitem">
<entry key="stockitem.SOAP">100</entry>
</util:map>
</constructor-arg>
UPDATE
这里是我的豆子配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<bean class = "java.util.EnumMap">
<constructor-arg>
<util:map key-type="org.itemlist.products.stockitem">
<entry key="stockitem.SOAP">100</entry>
</util:map>
</constructor-arg>
</bean>
</beans>
当我里面添加条目的价值,这就是现在的错误
cvc-complex-type.2.3: Element 'entry' cannot have character [children], because the type's content type is element-only.
Ooops,我忘记了,但是当我添加它仍然有一个错误 – user962206 2013-02-20 02:34:48
听起来像你应该更新的东西,告诉我们什么是新问题... – 2013-02-20 02:37:04
我已经更新它。 – user962206 2013-02-20 02:41:00