}
public void setItemDAO(IItemDAO itemDAO) {//此出给spring提供写入的方法
this.itemDAO = itemDAO;
}
public void setOrderDAO(IOrderDAO orderDAO) {//此出给spring提供写入的方法
this.orderDAO = orderDAO;
}
}
3.3 Spring中有关此事务XML配置
配置文件applicationContext.xml(注意相同颜色字之间的对应关系,其他bean的配置在此就省略掉了)。
<bean id="itemdao" class="com.trx.db.dao.ItemDAOImpl" autowire="byName" >
<bean id="orderdao" class="com.trx.db.dao.OrderDAOImpl " autowire="byName" >
<!--配置对应的Target-->
<bean id="itemBOTarget" class="com.trx.db.bo. TransactionTestImpl ">
<property name="itemDAO"><!—此处对于上面定义的bean-->
<ref bean="itemdao"/>
</property>
<property name="orderDAO">
<ref bean="orderdao"/>
</property>
</bean>
<!--此处注入上面配置好的Target的ProxyFactoryBean-->
<bean id="transationBO" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="itemBOTarget" />
</property>
<property name="transactionAttributes">
<props>
|