读书人

Spring 2.5.6引见(七)自动装载con

发布时间: 2012-08-24 10:00:20 作者: rapoo

Spring 2.5.6介绍(七)——自动装载constructo模式

package cn.csdn.service;public class AddressServiceImpl { private String address; public void setAddress(String address) { this.address = address; }}

package cn.csdn.service;public class EmpServiceImpl {private AddressServiceImpl addressServiceImpl ; public EmpServiceImpl(AddressServiceImpl addressServiceImp){this.addressServiceImpl = addressServiceImpl;}}

<?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-2.0.xsd"> <bean id="addressServiceImpl" scope="singleton" autowire="constructo "> </bean></beans>

?

读书人网 >软件架构设计

热点推荐