如果一个集合对象不光光是注入到一个对象中,那我们需要考虑此集合对象设置ID
List
<
bean
id
="mails"
class
="org.springframework.beans.factory.config.ListFactoryBean"
>
< property name ="sourceList" >
< value > data1 </ value >
< value > data2 </ value >
< property >
</ bean >
< property name ="sourceList" >
< value > data1 </ value >
< value > data2 </ value >
< property >
</ bean >
Map
<
bean
id
="mails"
class
="org.springframework.beans.factory.config.MapFactoryBean"
>
< property name ="sourceMap" >
< map >
< entry key ="data1" value ="data1" />
< entry key ="data2" value ="data2" />
</ map >
< property >
</ bean >
< property name ="sourceMap" >
< map >
< entry key ="data1" value ="data1" />
< entry key ="data2" value ="data2" />
</ map >
< property >
</ bean >
Set
<
bean
id
="mails"
class
="org.springframework.beans.factory.config.SetFactoryBean"
>
< property name ="sourceSet" >
< set >
< value > data1 </ value >
< value > data2 </ value >
</ set >
< property >
</ bean >
< property name ="sourceSet" >
< set >
< value > data1 </ value >
< value > data2 </ value >
</ set >
< property >
</ bean >
properties
<
bean
id
="mails"
class
="org.springframework.beans.factory.config.PropertiesFactoryBean"
>
< props >
< prop key ="somekey" > somekey </ prop >
< prop key ="anykey" > anykey </ prop >
</ props >
</ bean >
<!-- -或者使用location属性->
<property name="localtion">
<value>src/config/config.properties</value>
</property>
< props >
< prop key ="somekey" > somekey </ prop >
< prop key ="anykey" > anykey </ prop >
</ props >
</ bean >
<!-- -或者使用location属性->
<property name="localtion">
<value>src/config/config.properties</value>
</property>