其他事务文章
瑞吉外卖 Dto对象 & 事务机制
课程:https://www.nowcoder.com/study/live/246/3/13
@Transactional(isolation = Isolation.READ_COMMITED, propagation = Propagation.REQIRED)
// isolation 隔离级别
// propagation 传播机制
public test(){};
public Object save2() {
transactionTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
return transactionTemplate.execute(new TransactionCallback<Object>() {
@Override
public Object doInTransaction(TransactionStatus status) {
// 新增用户
// 新增帖子
Integer.valueOf("abc");
return "ok";
}
});
}