applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<bean id="user" class="com.bdqn.entity.User">
<constructor-arg name="uname" value="user03"/>
<constructor-arg name="upwd" value="123" />
<constructor-arg name="ugender" value="2" />
<constructor-arg name="uage" value="26" />
<constructor-arg name="udesc" value="普通用户1" />
</bean>
<bean id="user2" class="com.bdqn.entity.User" p:uname="user04" p:upwd="123" p:ugender="1" p:uage="21" p:udesc="VIP用户04" p:addr-ref="address"/>
<bean id="address" class="com.bdqn.entity.Address" p:addreDesc="这是个地址"></bean>
</beans>
applicationContextService.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" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<import resource="applicationContext.xml" />
</beans>