Top Description Methods
org.springframework.transaction.interceptor

public Interface TransactionAttributeSource

Known Direct Implementers
org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource, org.springframework.transaction.interceptor.CompositeTransactionAttributeSource, org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource, org.springframework.transaction.interceptor.MethodMapTransactionAttributeSource, org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource
Imports
java.lang.reflect.Method, org.springframework.lang.Nullable

Strategy interface used by TransactionInterceptor for metadata retrieval.

Implementations know how to source transaction attributes, whether from configuration, metadata attributes at source level (such as annotations), or anywhere else.

Authors
Rod Johnson, Juergen Hoeller
Since
15.04.2003
See Also
TransactionInterceptor#setTransactionAttributeSource, TransactionProxyFactoryBean#setTransactionAttributeSource, org.springframework.transaction.annotation.AnnotationTransactionAttributeSource

Method Summary

Modifier and TypeMethod and Description
public TransactionAttribute

Returns:

the matching transaction attribute, or null if none found
getTransactionAttribute
(Method
the method to introspect
method
,
Class<?>
the target class (may be null, in which case the declaring class of the method must be used)
targetClass
)

Return the transaction attribute for the given method, or null if the method is non-transactional.

public default boolean

Returns:

false if the class is known to have no transaction attributes at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.
isCandidateClass
(Class<?>
the class to introspect
targetClass
)

Determine whether the given class is a candidate for transaction attributes in the metadata format of this TransactionAttributeSource.

Method Detail

getTransactionAttributeback to summary
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass)

Return the transaction attribute for the given method, or null if the method is non-transactional.

Parameters
method:Method

the method to introspect

targetClass:Class<?>

the target class (may be null, in which case the declaring class of the method must be used)

Returns:TransactionAttribute

the matching transaction attribute, or null if none found

Annotations
@Nullable
isCandidateClassback to summary
public default boolean isCandidateClass(Class<?> targetClass)

Determine whether the given class is a candidate for transaction attributes in the metadata format of this TransactionAttributeSource.

If this method returns false, the methods on the given class will not get traversed for getTransactionAttribute introspection. Returning false is therefore an optimization for non-affected classes, whereas true simply means that the class needs to get fully introspected for each method on the given class individually.

Parameters
targetClass:Class<?>

the class to introspect

Returns:boolean

false if the class is known to have no transaction attributes at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.

Since
5.2