spring事务-代码中控制
作者:互联网
- 1.首先需要在代码中注入事务管理器
@Autowired
private PlatformTransactionManager transactionManager; - 2.代码中使用如下
public void dealResult(Map<String,List<WKOrder>> resultMap){TransactionTemplate template = new TransactionTemplate(transactionManager);template.execute(new TransactionCallbackWithoutResult(){@Overrideprotected void doInTransactionWithoutResult(TransactionStatus arg0) {//TODO:实现你的业务逻辑}});}
标签:事务,spring,代码,TransactionTemplate,template,new,void,transactionManager 来源: https://blog.csdn.net/qq_32784303/article/details/121293567