恩,主要就是:我配置了一个事务的管理advisor 和一个日志管理的aspect,但是当他们切入同一个包的时候,事务就管用了。(其中,之前事务是可以用的。同时,如下,我在第一个config里配置了2个代理分别是事务和日志的是管理service包的,在第二个config里配置了切入其他包的aspect)
目前,情况就是日志的好用,而事务失灵了。抛出异常并不发生回滚了。请大侠指点高招。<!-- aop 切入事务管理到 -->
<tx:advice id="txAdvice" transaction-manager="jotm_txManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="insert*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="del*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="update*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="mod*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- cglib代理service -->
<aop:config proxy-target-class="false">
<aop:pointcut id="allServiceMethod" expression="execution (* com.sinosoft.perfect.*.*.service.*.*(..))
|| execution (* com.sinosoft.perfect.*.service.*.*(..))"/>
<aop:advisor order="1" advice-ref="txAdvice" pointcut-ref="allServiceMethod" />
<aop:aspect id="loggerAspect2" ref="genericLoggerBean2" order="1000">
<aop:around pointcut-ref="allServiceMethod" method="invoke" />
</aop:aspect>
</aop:config>
<!-- aop 切入日志 -->
<aop:config proxy-target-class="true">
<aop:aspect id="loggerAspect" ref="genericLoggerBean">
<aop:around pointcut="execution(* com.sinosoft.perfect.*.*.action.*.*(..))
||execution(* com.sinosoft.perfect.common.action.*.*(..))" method="invoke" />
</aop:aspect>
</aop:config>
<!-- aop 切入日志 -->
<bean id="genericLoggerBean" class="com.sinosoft.perfect.common.bean.GenericLoggerBean"></bean>
<bean id="genericLoggerBean2" class="com.sinosoft.perfect.common.bean.GenericLoggerBean2"></bean>
目前,情况就是日志的好用,而事务失灵了。抛出异常并不发生回滚了。请大侠指点高招。<!-- aop 切入事务管理到 -->
<tx:advice id="txAdvice" transaction-manager="jotm_txManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="insert*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="del*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="update*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="mod*" propagation="REQUIRED" rollback-for="Exception" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- cglib代理service -->
<aop:config proxy-target-class="false">
<aop:pointcut id="allServiceMethod" expression="execution (* com.sinosoft.perfect.*.*.service.*.*(..))
|| execution (* com.sinosoft.perfect.*.service.*.*(..))"/>
<aop:advisor order="1" advice-ref="txAdvice" pointcut-ref="allServiceMethod" />
<aop:aspect id="loggerAspect2" ref="genericLoggerBean2" order="1000">
<aop:around pointcut-ref="allServiceMethod" method="invoke" />
</aop:aspect>
</aop:config>
<!-- aop 切入日志 -->
<aop:config proxy-target-class="true">
<aop:aspect id="loggerAspect" ref="genericLoggerBean">
<aop:around pointcut="execution(* com.sinosoft.perfect.*.*.action.*.*(..))
||execution(* com.sinosoft.perfect.common.action.*.*(..))" method="invoke" />
</aop:aspect>
</aop:config>
<!-- aop 切入日志 -->
<bean id="genericLoggerBean" class="com.sinosoft.perfect.common.bean.GenericLoggerBean"></bean>
<bean id="genericLoggerBean2" class="com.sinosoft.perfect.common.bean.GenericLoggerBean2"></bean>
解决方案 »
- 【资源分享】Hadoop实战开发教程
- csdn会员快到期,还有1100多次免积分下载,可帮助需要的人下载
- Error creating bean with name 'salLevelDAO' 谁帮我解释下,新手求助
- hibernate 查询
- linux yum error,这个error已经困扰我好一段时间了.各位大哥哥指点一下小弟,感激不尽
- spring+jpa第一次尝试,出现问题--执行了添加程序,但是数据库中没有写入
- 请教一个比较难的问题,谢谢各位支持
- 我快跳楼的问题,请给为英雄拯救啊!
- struts Action中 返回findForward跳转的问题
- 使用jfreechart做柱线图时,如何设置x轴和y轴的长度?
- 求java网站url重写(实现伪静态)
- 急。。js树形菜单,节点值传递问题
<aop:config proxy-target-class="false">
要改成true吗?
默认代理是依据接口的
为什么你要给事务配置用cglib代理哪
统一一下