当前位置:编程学习 > XML/UML >>

Spring xml配置注入数组/list/Map

---注入数组/list/Map----
<!-- 数组注入方式 -->
<property name="homes">
<list>
<ref bean="myHome1" />
<ref bean="myHome2" />
</list>
</property>
<!-- List注入方式 -->
<property name="homesList">
<list>
<ref bean="myHome1" />
<ref bean="myHome2" />
<value>haha</value>
</list>
</property> www.zzzyk.com
<!-- Map注入方式 -->
<property name="homesMap">
<map>
<entry key="1">
<ref bean="myHome1" />
</entry>
<entry key="2">
<ref bean="myHome2" />
</entry>
</map>
</property>
补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,