transactionTemplate.execute
@Override
//在编程事物中
public boolean saveUser(final UserModel um,final String person) {boolean execute = (boolean) this.transactionTemplate.execute(new TransactionCallback<Object>() {
@Override
public Object doInTransaction(TransactionStatus status) {
boolean fag = false;
try {
//业务处理成功
fag=true;
} catch (Exception e) {
log.error("Exception ={}",e);
//在异常的情况下回滚
status.setRollbackOnly();throw new Exception();
}
return fag;
}});
return execute;
}