Search in sources :

Example 1 with AnnotationTransactionAttributeSource

use of org.springframework.transaction.annotation.AnnotationTransactionAttributeSource in project spring-framework by spring-projects.

the class TransactionAspectTests method testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotatedInterface.

/**
	 * Note: resolution does not occur. Thus we can't make a class transactional if
	 * it implements a transactionally annotated interface. This behavior could only
	 * be changed in AbstractFallbackTransactionAttributeSource in Spring proper.
	 * See SPR-14322.
	 */
@Test
public void testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotatedInterface() throws Exception {
    AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
    Method method = ImplementsAnnotatedInterface.class.getMethod("echo", Throwable.class);
    TransactionAttribute ta = atas.getTransactionAttribute(method, ImplementsAnnotatedInterface.class);
    assertNull(ta);
}
Also used : TransactionAttribute(org.springframework.transaction.interceptor.TransactionAttribute) Method(java.lang.reflect.Method) AnnotationTransactionAttributeSource(org.springframework.transaction.annotation.AnnotationTransactionAttributeSource) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Test (org.junit.Test)1 AnnotationTransactionAttributeSource (org.springframework.transaction.annotation.AnnotationTransactionAttributeSource)1 TransactionAttribute (org.springframework.transaction.interceptor.TransactionAttribute)1