クラス AnnotationTransactionAttributeSource
- 実装されたすべてのインターフェース:
SerializableSE
、Aware
、EmbeddedValueResolverAware
、TransactionAttributeSource
TransactionAttributeSource
インターフェースの実装。 このクラスは、Spring の @Transactional
アノテーションを読み取り、対応するトランザクション属性を Spring のトランザクションインフラストラクチャに公開します。また、JTA の Transactional
EE および EJB の TransactionAttribute
EE アノテーション (存在する場合) もサポートします。
このクラスは、カスタム TransactionAttributeSource の基本クラスとして使用することも、TransactionAnnotationParser
戦略を通じてカスタマイズすることもできます。
- 導入:
- 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 を作成し、Transactional
アノテーションまたは EJB3TransactionAttribute
EE アノテーションを運ぶ public メソッドをサポートします。AnnotationTransactionAttributeSource
(boolean publicMethodsOnly) Transactional
アノテーションまたは EJB3TransactionAttribute
EE アノテーションを運ぶ public メソッドをサポートするカスタム AnnotationTransactionAttributeSource を作成します。AnnotationTransactionAttributeSource
(TransactionAnnotationParser annotationParser) カスタム AnnotationTransactionAttributeSource を作成します。AnnotationTransactionAttributeSource
(TransactionAnnotationParser... annotationParsers) カスタム AnnotationTransactionAttributeSource を作成します。方法の概要
修飾子と型メソッド説明void
addDefaultRollbackRule
(RollbackRuleAttribute rollbackRule) このソースによって返されるすべてのルールベースのトランザクション属性に適用されるデフォルトのロールバックルールを追加します。protected boolean
デフォルトでは、public メソッドのみをトランザクション対応にすることができます。protected TransactionAttribute
指定されたメソッドまたはクラスのトランザクション属性を決定します。boolean
protected TransactionAttribute
findTransactionAttribute
(ClassSE<?> clazz) サブクラスは、特定のクラスのトランザクション属性があれば、それを返すためにこれを実装する必要があります。protected TransactionAttribute
findTransactionAttribute
(MethodSE method) サブクラスは、指定されたメソッドのトランザクション属性があればそれを返すためにこれを実装する必要があります。int
hashCode()
boolean
isCandidateClass
(ClassSE<?> targetClass) 指定されたクラスが、このTransactionAttributeSource
のメタデータ形式のトランザクション属性の候補であるかどうかを判別します。void
setPublicMethodsOnly
(boolean publicMethodsOnly) トランザクションメソッドがパブリックであることが予想されるかどうかを設定します。クラス org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource から継承されたメソッド
computeTransactionAttribute, getCacheKey, getTransactionAttribute, hasTransactionAttribute, setEmbeddedValueResolver
コンストラクターの詳細
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource()デフォルトの AnnotationTransactionAttributeSource を作成し、Transactional
アノテーションまたは EJB3TransactionAttribute
EE アノテーションを運ぶ public メソッドをサポートします。AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource(boolean publicMethodsOnly) Transactional
アノテーションまたは EJB3TransactionAttribute
EE アノテーションを運ぶ public メソッドをサポートするカスタム AnnotationTransactionAttributeSource を作成します。- パラメーター:
publicMethodsOnly
-Transactional
アノテーションのみを保持する public メソッド(通常はプロキシベースの AOP で使用)、または保護 / プライベートメソッドもサポートするかどうか (通常、AspectJ クラスのウィービングで使用されます)- 関連事項:
AnnotationTransactionAttributeSource
カスタム AnnotationTransactionAttributeSource を作成します。- パラメーター:
annotationParser
- 使用する TransactionAnnotationParser
AnnotationTransactionAttributeSource
カスタム AnnotationTransactionAttributeSource を作成します。- パラメーター:
annotationParsers
- 使用する TransactionAnnotationParsers
メソッドの詳細
setPublicMethodsOnly
public void setPublicMethodsOnly(boolean publicMethodsOnly) トランザクションメソッドがパブリックであることが予想されるかどうかを設定します。デフォルトは
true
です。- 導入:
- 6.2
- 関連事項:
addDefaultRollbackRule
このソースによって返されるすべてのルールベースのトランザクション属性に適用されるデフォルトのロールバックルールを追加します。デフォルトでは、ロールバックはチェックされていない例外ではトリガーされますが、チェックされた例外ではトリガーされません。デフォルトのルールは、トランザクション属性のカスタムルールを考慮しながら、これをオーバーライドできます。
- パラメーター:
rollbackRule
- デフォルトの動作を上書きするロールバックルール(例:RollbackRuleAttribute.ROLLBACK_ON_ALL_EXCEPTIONS
)- 導入:
- 6.2
- 関連事項:
isCandidateClass
インターフェースからコピーされた説明:TransactionAttributeSource
指定されたクラスが、このTransactionAttributeSource
のメタデータ形式のトランザクション属性の候補であるかどうかを判別します。このメソッドが
false
を返す場合、指定されたクラスのメソッドはTransactionAttributeSource.getTransactionAttribute(java.lang.reflect.Method, java.lang.Class<?>)
イントロスペクションのために走査されません。false
を返すことは、影響を受けないクラスの最適化です。一方、true
は、クラスが特定のクラスの各メソッドに対して個別に完全にイントロスペクションする必要があることを意味します。- 次で指定:
- インターフェース
TransactionAttributeSource
のisCandidateClass
- パラメーター:
targetClass
- イントロスペクトするクラス- 戻り値:
- クラスまたはメソッドレベルでトランザクション属性を持たないことがクラスに知られている場合は
false
。それ以外の場合はtrue
。デフォルトの実装はtrue
を返し、通常のイントロスペクションにつながります。 - 関連事項:
findTransactionAttribute
クラスからコピーされた説明:AbstractFallbackTransactionAttributeSource
サブクラスは、特定のクラスのトランザクション属性があれば、それを返すためにこれを実装する必要があります。- 次で指定:
- クラス
AbstractFallbackTransactionAttributeSource
のfindTransactionAttribute
- パラメーター:
clazz
- 属性を取得するクラス- 戻り値:
- このクラスに関連付けられているすべてのトランザクション属性、または存在しない場合は
null
findTransactionAttribute
クラスからコピーされた説明:AbstractFallbackTransactionAttributeSource
サブクラスは、指定されたメソッドのトランザクション属性があればそれを返すためにこれを実装する必要があります。- 次で指定:
- クラス
AbstractFallbackTransactionAttributeSource
のfindTransactionAttribute
- パラメーター:
method
- 属性を取得するメソッド- 戻り値:
- このメソッドに関連付けられたすべてのトランザクション属性。ない場合は
null
determineTransactionAttribute
指定されたメソッドまたはクラスのトランザクション属性を決定します。この実装は、既知のアノテーションを Spring のメタデータ属性クラスに解析するために、構成済みの
TransactionAnnotationParsers
に委譲します。トランザクションでない場合、null
を返します。トランザクションメタデータを運ぶカスタムアノテーションをサポートするためにオーバーライドできます。
- パラメーター:
element
- アノテーション付きのメソッドまたはクラス- 戻り値:
- 設定されたトランザクション属性、または何も見つからなかった場合は
null
allowPublicMethodsOnly
protected boolean allowPublicMethodsOnly()デフォルトでは、public メソッドのみをトランザクション対応にすることができます。equals
hashCode
public int hashCode()