手动回滚
通常情况下,主动回滚事务,可以手动抛异常即可,不抛异常可以如下方式回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
手动提交
@Resource private PlatformTransactionManager transactionManager; TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); transactionManager.commit(TransactionAspectSupport.currentTransactionStatus());
附加:获取spring的ApplicationContext几种方式
https://www.cnblogs.com/wangcp-2014/p/8126187.html