クラス AnnotationTransactionAttributeSource
- 実装されているすべてのインターフェース:
SerializableSE、Aware、EmbeddedValueResolverAware、TransactionAttributeSource
TransactionAttributeSource インターフェースの実装。 このクラスは、Spring の @Transactional アノテーションを読み取り、対応するトランザクション属性を Spring のトランザクションインフラストラクチャに公開します。また、JTA の TransactionalEE および EJB の TransactionAttributeEE アノテーション (存在する場合) もサポートします。
このクラスは、カスタム TransactionAttributeSource の基本クラスとして使用することも、TransactionAnnotationParser 戦略を通じてカスタマイズすることもできます。
- 導入:
- 1.2
- 作成者:
- Colin Sampaleanu, Juergen Hoeller
- 関連事項:
TransactionalTransactionAnnotationParserSpringTransactionAnnotationParserEjb3TransactionAnnotationParserTransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)TransactionProxyFactoryBean.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)- 連載形式
フィールドのサマリー
クラス org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource から継承されたフィールド
loggerコンストラクターの概要
コンストラクターコンストラクター説明デフォルトの AnnotationTransactionAttributeSource を作成し、Transactionalアノテーションまたは EJB3TransactionAttributeEE アノテーションを運ぶ public メソッドをサポートします。AnnotationTransactionAttributeSource(boolean publicMethodsOnly) Transactionalアノテーションまたは EJB3TransactionAttributeEE アノテーションを運ぶ public メソッドをサポートするカスタム AnnotationTransactionAttributeSource を作成します。AnnotationTransactionAttributeSource(TransactionAnnotationParser annotationParser) カスタム AnnotationTransactionAttributeSource を作成します。AnnotationTransactionAttributeSource(TransactionAnnotationParser... annotationParsers) カスタム AnnotationTransactionAttributeSource を作成します。メソッドのサマリー
修飾子と型メソッド説明voidaddDefaultRollbackRule(RollbackRuleAttribute rollbackRule) このソースによって返されるすべてのルールベースのトランザクション属性に適用されるデフォルトのロールバックルールを追加します。protected booleanデフォルトでは、public メソッドのみをトランザクション対応にすることができます。protected TransactionAttribute指定されたメソッドまたはクラスのトランザクション属性を決定します。booleanprotected TransactionAttributefindTransactionAttribute(ClassSE<?> clazz) サブクラスは、特定のクラスのトランザクション属性があれば、それを返すためにこれを実装する必要があります。protected TransactionAttributefindTransactionAttribute(MethodSE method) サブクラスは、指定されたメソッドのトランザクション属性があればそれを返すためにこれを実装する必要があります。inthashCode()booleanisCandidateClass(ClassSE<?> targetClass) 指定されたクラスが、このTransactionAttributeSourceのメタデータ形式のトランザクション属性の候補であるかどうかを判別します。voidsetPublicMethodsOnly(boolean publicMethodsOnly) トランザクションメソッドがパブリックであることが予想されるかどうかを設定します。クラス org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource から継承されたメソッド
computeTransactionAttribute, getCacheKey, getTransactionAttribute, hasTransactionAttribute, setEmbeddedValueResolver
コンストラクターの詳細
AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource()デフォルトの AnnotationTransactionAttributeSource を作成し、Transactionalアノテーションまたは EJB3TransactionAttributeEE アノテーションを運ぶ public メソッドをサポートします。AnnotationTransactionAttributeSource
public AnnotationTransactionAttributeSource(boolean publicMethodsOnly) Transactionalアノテーションまたは EJB3TransactionAttributeEE アノテーションを運ぶ 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()