In proxy mode (which is the default), only external method calls coming in through the proxy are intercepted. This means that self-invocation, in effect, a method within the target object calling another method of the target object, will not lead to an actual transaction at runtime even if the invoked method is marked with @Transactional.

spring文档地址 :

http://docs.spring.io/spring/docs/4.2.0.RC1/spring-framework-reference/htmlsingle/#transaction-declarative-annotations

说明: 代理模式中,只拦截外部方法调用,开启事务。类内部调用无法实现事务控制。

错误示例:

public class Tx {

    public void a(){
b();
} @Transactional(propagation = Propagation.REQUIRED)
public void b(){ } }

正确示例:

public class Tx {

    @Transactional(propagation = Propagation.REQUIRED)
public void a(){
b();
} public void b(){ } }

最新文章

  1. ASP.NET MVC5+EF6+EasyUI 后台管理系统(4)-创建项目解决方案
  2. 移动端接口:java写get方式访问数据(springmvc+spring。。。)
  3. MySQL数据库常用命令
  4. java错误
  5. 前端打包/自动化构建工具:gulp
  6. mysql 存储结构
  7. 编译 Spring-framework的经验分享
  8. iconv内容,convmv文件名,unix2dos,dos2unix文件格式转换,od/cut/wc/dd/diff/uniq/nice/du等命令,linux文件名乱码,文件名,文件内容,vim编码设置
  9. Aggregating tests in suites
  10. ManagedPipelineHandler IIS
  11. Android中特殊图形的生成样例
  12. js全选与反选
  13. call和apply的小结
  14. MySQL管理员珍藏:十大必备工具盘点
  15. 学习go语言编程系列之定义变量
  16. python类型错误:'NoneType' object is not subscriptable
  17. [01] 初识SpringBoot:Hello World
  18. Python高级网络编程系列之第一篇
  19. SVN同步时报错:“Previous operation has not finished; run 'cleanup' if it was interrupted”
  20. 关于ajax上传文件的流程 和选择图片立即显示

热门文章

  1. mysql 慢查询记录方法
  2. delphi webbrowser 执行 js ---转
  3. CentOS开机卡在进度条,无法正常开机的排查办法
  4. struts2的异常配置
  5. tensorflow学习资料
  6. java script btoa与atob的
  7. JS 相关
  8. JDBC远程连接数据库
  9. Python repr() 函数
  10. day1:vcp考试