Files
notes_estom/Spring/Spring5/code/shangguigu03/src/bean01.xml
2022-10-14 23:39:59 +08:00

55 lines
1.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="student" class="com.ykl.collectiontype.Student">
<property name="courses" >
<array>
<value>java</value>
<value>c</value>
</array>
</property>
<property name="list" >
<list>
<value>zhangsan</value>
<value>xiaosan</value>
</list>
</property>
<property name="maps">
<map>
<entry key="java" value="java"></entry>
<entry key="name" value="hel"></entry>
</map>
</property>
<property name="sets">
<set>
<value>msyql</value>
<value>redis</value>
</set>
</property>
<property name="courseList">
<list>
<ref bean="course1"></ref>
<ref bean="course2"></ref>
<ref bean="course3"></ref>
</list>
</property>
</bean>
<!-- 创建多个course对象-->
<bean id="course1" class="com.ykl.collectiontype.Course">
<property name="cname" value="c1"></property>
</bean>
<bean id="course2" class="com.ykl.collectiontype.Course">
<property name="cname" value="c2"></property>
</bean>
<bean id="course3" class="com.ykl.collectiontype.Course">
<property name="cname" value="c3"></property>
</bean>
</beans>