67,513
社区成员
发帖
与我相关
我的任务
分享
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="query*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="load*" read-only="true" propagation="NOT_SUPPORTED"/>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 配置哪些类哪些方法使用事务 -->
<aop:config proxy-target-class="true">
<aop:pointcut id="allManagerMethod"
expression="(execution(* com.teamsun.drp.service..*.*(..))) " />
<aop:advisor advice-ref="txAdvice"
pointcut-ref="allManagerMethod" />
</aop:config>
public void a()throws Exception{
dao.update();
b();
}
public void b()throws centerException(){
....
throw new centerException("有错");
}
public void a()throws Exception{
dao.update();
b();
}
public void b()throws centerException(){
....
throw new centerException("有错");
}