<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-3.0.xsd">
<bean id="customerDAO" class="com.hebeu.customer.dao.JdbcCustomerDAO">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
<bean id="customer" class="com.yiibai.common.Customer" autowire="byName" />
package com.hebeu.model;
public class Customer {
private Address address;
public Customer() {
}
public Customer(int id, Address address) {
super();
this.address = address;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
package com.hebeu.model;
public class Address {
private String fulladdress;
public Address(){
}
public Address(String addr){
this.fulladdress = addr;
}
public String getFulladdress() {
return fulladdress;
}
public void setFulladdress(String fulladdress) {
this.fulladdress = fulladdress;
}
}
<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-3.0.xsd">
<bean id="customer" class="com.hebeu.model.Customer" autowire="byName"></bean>
<bean id="address" class="com.hebeu.model.Address">
<property name="fulladdress" value="YiLong Road, CA 188"></property>
</bean>
</beans>
<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-3.0.xsd">
<bean id="customer" class="com.hebeu.model.Customer" <strong><span style="color:#FF0000;">autowire="byType"</span></strong>></bean>
<bean id="bean1" class="com.hebeu.model.Address">
<property name="fulladdress" value="YiLong Road, CA 188"></property>
</bean>
</beans>
<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-3.0.xsd">
<bean id="customer" class="com.hebeu.model.Customer" autowire="byType"></bean>
<bean id="bean1" class="com.hebeu.model.Address">
<property name="fulladdress" value="YiLong Road, CA 188"></property>
</bean>
<bean id="bean2" class="com.hebeu.model.Address">
<property name="fulladdress" value="YiLong Road, CA 188"></property>
</bean>
</beans>
<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-3.0.xsd">
<bean id="customer" class="com.hebeu.model.Customer">
<!-- 构造方法的参数 -->
<constructor-arg>
<ref bean="bean1"/>
</constructor-arg>
</bean>
<bean id="bean1" class="com.hebeu.model.Address">
<property name="fulladdress" value="YiLong Road, CA 188"></property>
</bean>
</beans>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有