Spring Bean에서 Map Property 설정

Map<String, Map<String, MyInterface>> 라는 형태로 Map을 설정하고 싶었다.
설정 XML은 다음과 같다.

<bean id="myBean" class="com.egloos.cyberhp.MyBean">
        <property name="myMap">
            <map>
                <entry>
                    <key>
                        <value>FirstKey</value>
                    </key>
                    <map>
                        <entry key="FirstSubKey" value-ref="myInterface" />
                    </map>
                </entry>
                <entry>
                    <key>
                        <value>SecondKey</value>
                    </key>
                    <map>
                        <entry key="SecondSubKey" value-ref="yourInterface" />
                    </map>
                </entry>
             </map>
         </property>
</bean>
<bean id="myInteface" class="..."/>
<bean id="yourInteface" class="..."/>

물론 MyInterface 형태로 받아야 하기에 myInterface와 yourInterface는 MyInterface를 구현해야 한다.

Creative Commons License
이 저작물은 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 2.0 대한민국 라이선스에 따라 이용할 수 있습니다.

이 글과 관련있는 글을 자동검색한 결과입니다 [?]

by hops | 2009/04/21 21:24 | 작업일지 | 트랙백 | 덧글(0)

트랙백 주소 : http://cyberhp.egloos.com/tb/1379713
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

<< 이전 페이지다음 페이지 >>