after-throwing 捕获 分布式事务异常的 疑问
项目采用 三层结构 用到了分布式事务,包裹的是services层的方法,相关配置如下:
<bean id="abstractTransactionProxy" abstract="true" parent="abstractTransactionProxy"> <property name="target"> <ref bean="ocsServices"/> </property> </bean> <aop:config> <aop:aspect id="prefixAspect4" ref="logInterceptor"> <aop:pointcut id="prefixPointCut4" expression="execution(* services.OcsServices.add(Object)) and args(Object)" /> <aop:after-throwing pointcut-ref="prefixPointCut4" method="afterThrowing" throwing="dataAccessException"/> </aop:aspect> </aop:config> <bean id="logInterceptor" name="code"> public void add(Object o) { Prefix oo = (Prefix)o; Iterator it = this.getDaoScpList().iterator(); while(it.hasNext()) { IPrefixDao ipd = (IPrefixDao)it.next(); ipd.savePrefix(oo); } }