Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Map of Maps Initialization in Application Context

Tags:

spring

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.AsyncAddressChangeEventVO">
                    <value>com.yyy.yyy.yyy.vo.yyy.FakeAcctAddressEvent</value>
                </entry>
            </map>
        </value>
        </entry>
    </map>
    </property>

</bean> 

Any help will be appreciated.

like image 271
Vanchinathan Chandrasekaran Avatar asked Mar 07 '11 23:03

Vanchinathan Chandrasekaran


1 Answers

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

like image 59
Dhananjay Avatar answered Oct 10 '22 21:10

Dhananjay