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