@Autowiredprivate DataSourceTransactionManager transactionManager; //1.获取事务定义DefaultTransactionDefinition def = new DefaultTransactionDefinition();//2.设置事务隔离级别,开启新事务def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);//3.获得事务状态
TransactionStatus status = transactionManager.getTransaction(def);// 事务回滚
transactionManager.rollback(status);// 事务提交
transactionManager.commit(status);