<?xml version="1.0" encoding="GBK"?>
<!-- Spring配置文件的根元素,使用spring-beans-4.0.xsd语义约束 -->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
<bean id="chinese" class="org.crazyit.app.service.impl.Chinese">
<property name="axe" ref="steelAxe"/>
<property name="Stuname" value="zhangsan"/>
</bean>
<bean id="stoneAxe" class="org.crazyit.app.service.impl.StoneAxe"/>
<bean id="steelAxe" class="org.crazyit.app.service.impl.SteelAxe"/>
</beans>
<?xml version="1.0" encoding="GBK"?>
<!-- Spring配置文件的根元素,使用spring-beans-4.0.xsd语义约束 -->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
<bean id="chinese" class="org.crazyit.app.service.impl.Chinese">
<constructor-arg ref="steelAxe" type="org.crazyit.app.service.Axe"/>
<constructor-arg value="zhangsan" type="String"/>
</bean>
<bean id="stoneAxe" class="org.crazyit.app.service.impl.StoneAxe"/>
<bean id="steelAxe" class="org.crazyit.app.service.impl.SteelAxe"/>
</beans>
原文:http://www.cnblogs.com/ssslinppp/p/4372205.html