我正在尝试在我的 Spring beans 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>
更新
这是我的bean配置
<?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.