<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- 配置teacher-->
<bean id="teacher" class="lbl.bean.Teacher">
<property name="tid" value="1"/><!--普通配置-->
<property name="tname" value="老师1"/>
</bean>
<!-- 配置student-->
<bean id="student" class="lbl.bean.Student">
<property name="name" value="小红"/>
<property name="list"><!--list属性配置-->
<list>
<value>小明1</value>
<value>小明2</value>
<value>小明3</value>
</list>
</property>
<property name="set">
<set><!--set属性配置-->
<value>小明1</value>
<value>小明2</value>
<value>小明3</value>
</set>
</property>
<property name="map">
<map><!--map属性配置-->
<entry key="id" value="1"/>
<entry key="name" value="小明"/>
</map>
</property>
<property name="teacher" ref="teacher"/><!--引用类属性配置-->
</bean>
<!--内部类属性配置-->
<bean id="person3" class="路径">
<property name="name" value="Jerry"></property>
<property name="age" value="27"></property>
<property name="car">
<bean class="路径">
<constructor-arg value="Ford"></constructor-arg>
<constructor-arg value="ChangAn"></constructor-arg>
<constructor-arg value="260" type="int"></constructor-arg>
</bean>
</property>
</bean>
<!--可以使用专用的 <null/> 元素标签为 Bean 的字符串或其它对象类型的属性注入 null 值。-->
<!-- null元素的使用 -->
<bean id="person4" class="路径">
<property name="name" value="hunan"></property>
<property name="age" value="23"></property>
<property name="car" ><null/></property>
</bean>
<!--使用 <props> 定义 java.util.Properties, 该标签使用多个 <prop> 作为子标签. 每个 <prop> 标签必须定义 key 属性.-->
<bean id="jdbcproperties" class="路径">
<property name="properties">
<props>
<prop key="username">root</prop>
<prop key="password">123</prop>
<prop key="url">jdbc:mysql:///test</prop>
<prop key="driver">com.mysql.jdbc.driver</prop>
</props>
</property>
</bean>
</beans>