开发者

Map of Maps Initialization in Application Context

开发者 https://www.devze.com 2023-02-15 04:54 出处:网络
I want to initialize a Map of Maps in the Spring context file. I\'m getting this xsd error. cvc-complex-type.2.4.d: Invalid content was found starting with element \'map\'. No child element is expec

I want to initialize a Map of Maps in the Spring context file. I'm getting this xsd error.

cvc-complex-type.2.4.d: Invalid content was found starting with element 'map'. No child element is expected at this point.

This is the bean defnition:

<bean id="voToDOMapper" class="com.yyy.yyy.yyy.yyy.configuration.VOToDOMapper" factory-method="getInstance">
    <property name="channelToMapper">
    <map key-type="java.lang.String" value-type="java.util.HashMap">
        <entry key="yyy" >
        <value>
            <map>
                <entry key="com.yyy.yyy.yyy.AsyncAdd开发者_C百科ressChangeEventVO">
                    <value>com.yyy.yyy.yyy.vo.yyy.FakeAcctAddressEvent</value>
                </entry>
            </map>
        </value>
        </entry>
    </map>
    </property>

</bean> 

Any help will be appreciated.


One way

<util:map>
        <entry key="x" value-ref="val1"></entry>
</util:map>

<util:map id="val1">
    <entry key="a" value="blob"></entry>
    <entry key="b" value="clob"></entry>
</util:map>

enable xmlns:util="http://www.springframework.org/schema/util


Example of using of util: http://www.java2s.com/Code/Java/Spring/CreateListMapInContext.htm

0

精彩评论

暂无评论...
验证码 换一张
取 消