forked from chenhaoxiang/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplicationContext2.xml
More file actions
59 lines (54 loc) · 1.73 KB
/
applicationContext2.xml
File metadata and controls
59 lines (54 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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: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-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean id="cat" class="cn.hncu.demo2.domain.Cat">
<!-- 初始化name -->
<property name="name" value="黑猫"></property>
</bean>
<bean id="user" class="cn.hncu.demo2.domain.User">
<property name="name" value="Jack"></property>
<property name="age" value="25"></property>
<property name="pets">
<list>
<value>cat</value>
<value>dog</value>
<value>tiger</value>
</list>
</property>
<property name="map">
<map>
<entry key="name" value="中国"></entry>
<entry key="age" value="67"></entry>
<!-- ref是引用 -->
<entry key="cat" value-ref="cat"></entry>
</map>
</property>
<property name="set">
<set>
<!-- 引用 -->
<ref bean="cat"/>
<value>aaa</value>
<value>bbb</value>
</set>
</property>
<property name="objs">
<!-- 数组 -->
<array>
<value>hrllo</value>
<ref bean="cat"/>
<list>
<value>obj1</value>
<value>obj2</value>
</list>
<bean class="cn.hncu.demo2.domain.Cat">
<property name="name" value="白猫"></property>
</bean>
</array>
</property>
</bean>
</beans>