1. 程式人生 > >Spring管理事務的方式

Spring管理事務的方式

SpringDay03

Spring管理事務的方式

1.編碼式

  • 1.將核心事務管理器配置到Spring容器

  • 2.配置TransactionTemplate模版

  • 3.將事務模版注入service

  • 4.在Service中呼叫模版

  • 測試

執行了兩次

2.xml配置(aop)

  • 1.導包

  • 2.匯入約束

1.編碼式