类 AnnotationTransactionAttributeSource
- java.lang.Object
- org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
- org.springframework.transaction.annotation.AnnotationTransactionAttributeSource
- 所有已实现的接口:
Serializable
,TransactionAttributeSource
public class AnnotationTransactionAttributeSource extends AbstractFallbackTransactionAttributeSource implements Serializable
Implementation of theTransactionAttributeSource
interface for working with transaction metadata in JDK 1.5+ annotation format.This class reads Spring's JDK 1.5+
Transactional
annotation and exposes corresponding transaction attributes to Spring's transaction infrastructure. Also supports JTA 1.2'sTransactional
and EJB3'sTransactionAttribute
annotation (if present). This class may also serve as base class for a custom TransactionAttributeSource, or get customized throughTransactionAnnotationParser
strategies.- 从以下版本开始:
- 1.2
- 作者:
- Colin Sampaleanu, Juergen Hoeller
- 另请参阅:
Transactional
,TransactionAnnotationParser
,SpringTransactionAnnotationParser
,Ejb3TransactionAnnotationParser
,TransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)
,TransactionProxyFactoryBean.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)
, 序列化表格
字段概要
从类继承的字段 org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
logger
构造器概要
构造器 构造器 说明 AnnotationTransactionAttributeSource()
Create a default AnnotationTransactionAttributeSource, supporting public methods that carry theTransactional
annotation or the EJB3TransactionAttribute
annotation.AnnotationTransactionAttributeSource(boolean publicMethodsOnly)
Create a custom AnnotationTransactionAttributeSource, supporting public methods that carry theTransactional
annotation or the EJB3TransactionAttribute
annotation.AnnotationTransactionAttributeSource(Set<TransactionAnnotationParser> annotationParsers)
Create a custom AnnotationTransactionAttributeSource.AnnotationTransactionAttributeSource(TransactionAnnotationParser annotationParser)
Create a custom AnnotationTransactionAttributeSource.AnnotationTransactionAttributeSource(TransactionAnnotationParser... annotationParsers)
Create a custom AnnotationTransactionAttributeSource.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected boolean
allowPublicMethodsOnly()
By default, only public methods can be made transactional.protected TransactionAttribute
determineTransactionAttribute(AnnotatedElement element)
Determine the transaction attribute for the given method or class.boolean
equals(Object other)
protected TransactionAttribute
findTransactionAttribute(Class<?> clazz)
Subclasses need to implement this to return the transaction attribute for the given class, if any.protected TransactionAttribute
findTransactionAttribute(Method method)
Subclasses need to implement this to return the transaction attribute for the given method, if any.int
hashCode()
从类继承的方法 org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
computeTransactionAttribute, getCacheKey, getTransactionAttribute
构造器详细资料
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource()
Create a default AnnotationTransactionAttributeSource, supporting public methods that carry theTransactional
annotation or the EJB3TransactionAttribute
annotation.
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource(boolean publicMethodsOnly)
Create a custom AnnotationTransactionAttributeSource, supporting public methods that carry theTransactional
annotation or the EJB3TransactionAttribute
annotation.- 参数:
publicMethodsOnly
- whether to support public methods that carry theTransactional
annotation only (typically for use with proxy-based AOP), or protected/private methods as well (typically used with AspectJ class weaving)
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource(TransactionAnnotationParser annotationParser)
Create a custom AnnotationTransactionAttributeSource.- 参数:
annotationParser
- the TransactionAnnotationParser to use
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource(TransactionAnnotationParser... annotationParsers)
Create a custom AnnotationTransactionAttributeSource.- 参数:
annotationParsers
- the TransactionAnnotationParsers to use
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource(Set<TransactionAnnotationParser> annotationParsers)
Create a custom AnnotationTransactionAttributeSource.- 参数:
annotationParsers
- the TransactionAnnotationParsers to use
方法详细资料
findTransactionAttribute
protected TransactionAttribute findTransactionAttribute(Class<?> clazz)
Subclasses need to implement this to return the transaction attribute for the given class, if any.- 指定者:
findTransactionAttribute
在类中AbstractFallbackTransactionAttributeSource
- 参数:
clazz
- the class to retrieve the attribute for- 返回:
- all transaction attribute associated with this class, or
null
if none
findTransactionAttribute
protected TransactionAttribute findTransactionAttribute(Method method)
Subclasses need to implement this to return the transaction attribute for the given method, if any.- 指定者:
findTransactionAttribute
在类中AbstractFallbackTransactionAttributeSource
- 参数:
method
- the method to retrieve the attribute for- 返回:
- all transaction attribute associated with this method, or
null
if none
determineTransactionAttribute
protected TransactionAttribute determineTransactionAttribute(AnnotatedElement element)
Determine the transaction attribute for the given method or class.This implementation delegates to configured
TransactionAnnotationParsers
for parsing known annotations into Spring's metadata attribute class. Returnsnull
if it's not transactional.Can be overridden to support custom annotations that carry transaction metadata.
- 参数:
element
- the annotated method or class- 返回:
- the configured transaction attribute, or
null
if none was found
allowPublicMethodsOnly
protected boolean allowPublicMethodsOnly()
By default, only public methods can be made transactional.