@Test void testUnitOfWorkCommit() throws Exception { subject.handle(unitOfWork, interceptorChain); unitOfWork.commit(); verify(transaction).commit(); }
@Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } TransactionManagingInterceptor(TransactionManager transactionManager); }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } TransactionManagingInterceptor(TransactionManager transactionManager); @Override Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain); }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } TransactionManagingInterceptor(TransactionManager transactionManager); @Override Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain);  }