use of org.springframework.transaction.interceptor.TransactionAttributeSource in project spring-framework by spring-projects.
the class TxNamespaceHandlerTests method rollbackRules.
@Test
public void rollbackRules() {
TransactionInterceptor txInterceptor = (TransactionInterceptor) context.getBean("txRollbackAdvice");
TransactionAttributeSource txAttrSource = txInterceptor.getTransactionAttributeSource();
TransactionAttribute txAttr = txAttrSource.getTransactionAttribute(getAgeMethod, ITestBean.class);
assertTrue("should be configured to rollback on Exception", txAttr.rollbackOn(new Exception()));
txAttr = txAttrSource.getTransactionAttribute(setAgeMethod, ITestBean.class);
assertFalse("should not rollback on RuntimeException", txAttr.rollbackOn(new RuntimeException()));
}
use of org.springframework.transaction.interceptor.TransactionAttributeSource in project uPortal by Jasig.
the class DialectAwareTransactionInterceptor method getTransactionAttributeSource.
@Override
public TransactionAttributeSource getTransactionAttributeSource() {
TransactionAttributeSource tas = this.wrappedTransactionAttributeSource;
if (tas == null) {
final TransactionAttributeSource transactionAttributeSource = super.getTransactionAttributeSource();
if (this.dialects.isEmpty()) {
return transactionAttributeSource;
}
tas = new TransactionAttributeSourceWrapper(this.dialects, transactionAttributeSource);
this.wrappedTransactionAttributeSource = tas;
}
return tas;
}
Aggregations