在项目中,存在20多个XXXDao数据操作处理类,所有这些Dao均实现同一接口IDao,我想通过通用的配置方法来配置事务管理,但是苦于没有思路,请指教.
比如通过设置通配符"*Dao",就可以针对20多个DAO类进行统一的事务配置,而无须一个个的单独配置
Spring 2.0以后支持这样的aop配置
[code="java"]
tx:attributes
/tx:attributes
/tx:advice
<aop:config>
<aop:pointcut id="servicePointcut" expression="execution(* cn.iwoo.service.*.*(..))"/>
<aop:advisor pointcut-ref="servicePointcut" advice-ref="serviceAdvice"/>
</aop:config>[/code]
TransactionProxyFactoryBean 都很老了, 没必要再每个dao,service都这样配置, aop方便多了.