1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://www.springframework.org/schema/beans
5 https://www.springframework.org/schema/beans/spring-beans.xsd">
6
7 <bean id="address" class="com.lieyan.pojo.Address">
8 <property name="address" value="北京"/>
9 </bean>
10
11 <bean id="student" class="com.lieyan.pojo.Student">
12 <!-- 普通值注入,value-->
13 <property name="name" value="烈焰"/>
14 <!-- bean注入,ref-->
15 <property name="address" ref="address"/>
16 <!-- 数组注入,ref-->
17 <property name="books">
18 <array>
19 <value>红楼梦</value>
20 <value>西游记</value>
21 <value>水浒传</value>
22 <value>三国演义</value>
23 </array>
24 </property>
25
26 <!-- List注入-->
27 <property name="hobbys">
28 <list>
29 <value>听歌</value>
30 <value>看电影</value>
31 <value>打游戏</value>
32 </list>
33 </property>
34 <!-- Map-->
35 <property name="card">
36 <map>
37 <entry key="身份证" value="123123123112311231"/>
38 <entry key="银行卡" value="123123121212231"/>
39 </map>
40 </property>
41 <!-- Set-->
42 <property name="games">
43 <set>
44 <value>LOL</value>
45 <value>CS</value>
46 <value>WOW</value>
47 </set>
48 </property>
49 <!-- null-->
50 <property name="wife">
51 <null/>
52 </property>
53 <!-- properties-->
54 <property name="info">
55 <props>
56 <prop key="id">20210906</prop>
57 <prop key="sex">男</prop>
58 </props>
59 </property>
60 </bean>
61
62 </beans>