<?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"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
添加红色部分
<bean id="some1" class="com.langzixin.spring.Some">
<property name="name" value="Fuck"/>
</bean>
<bean id="some2" class="com.langzixin.spring.Some">
<property name="name" value="Hell"/>
</bean>
<util:list id="strArray"> <!--字符串数组--> <value>Fuck</value> <value>Welcome</value> </util:list> <util:list id="objArray"><!--对象数组--> <ref bean="some1"/> <ref bean="some2"/> </util:list> <util:list id="list" list-class="java.util.ArrayList"><!--List--> <value>ListTest</value> <ref bean="some1"/> <ref bean="some2"/> </util:list> <util:map id="map" map-class="java.util.HashMap"><!--Map--> <entry key="MapTest" value="FuckWorld"/> <entry key="someKey" value-ref="some1"/> </util:map> <bean id="someBean02" class="com.langzixin.spring.SomeBean02"> <property name="someStrArray" ref="strArray"/> <property name="someObjArray" ref="objArray"/> <property name="someList" ref="list"/> <property name="someMap" ref="map"/> </bean>
配置Bean即可