spring方法内部调用方法事务关系

来源:互联网 发布:vb和微信公众号对接 编辑:程序博客网 时间:2024/06/05 17:37

Spring事务处理时自我调用的解决方案及一些实现方式的风险

参考资料:http://www.iteye.com/topic/1122740

class Demo{

@Transactional(propagation=Propagation.NOT_SUPPORTED)//不需要事务
    public Map<Integer,String> doPdaEcDeliver(RequestHeader header, String manifestID, List<EcProductEquipSendRowReq> equipList, String operatorName) throws TException {

((Demo)AopContext.currentProxy()).fun2();

   }

  @Transactional(propagation=Propagation.REQUIRES_NEW,rollbackForClassName={"RuntimeException","Exception","BusinessException"})
    public Map<Integer,String>   fun2() throws TException{    //修饰符必须为public,如果为private则方法内部会报异常,Dao层的对象为kong

          //业务操作

}


}

0 0