クラス AnnotationTransactionAttributeSource

java.lang.ObjectSE
org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource
org.springframework.transaction.annotation.AnnotationTransactionAttributeSource
実装されたすべてのインターフェース:
SerializableSEAwareEmbeddedValueResolverAwareTransactionAttributeSource

public class AnnotationTransactionAttributeSource extends AbstractFallbackTransactionAttributeSource implements SerializableSE
JDK 1.5 + アノテーション形式でトランザクションメタデータを操作するための TransactionAttributeSource インターフェースの実装。

このクラスは、Spring の JDK 1.5 + Transactional アノテーションを読み取り、対応するトランザクション属性を Spring のトランザクションインフラストラクチャに公開します。JTA 1.2 の TransactionalEE および EJB3 の TransactionAttributeEE アノテーション(存在する場合)もサポートします。このクラスは、カスタム TransactionAttributeSource の基本クラスとして機能することも、TransactionAnnotationParser 戦略を通じてカスタマイズされることもあります。

導入:
1.2
作成者:
Colin Sampaleanu, Juergen Hoeller
関連事項:
  • コンストラクターの詳細

    • AnnotationTransactionAttributeSource

      public AnnotationTransactionAttributeSource()
      デフォルトの AnnotationTransactionAttributeSource を作成し、Transactional アノテーションまたは EJB3 TransactionAttributeEE アノテーションを運ぶ public メソッドをサポートします。
    • AnnotationTransactionAttributeSource

      public AnnotationTransactionAttributeSource(boolean publicMethodsOnly)
      Transactional アノテーションまたは EJB3 TransactionAttributeEE アノテーションを運ぶ public メソッドをサポートするカスタム AnnotationTransactionAttributeSource を作成します。
      パラメーター:
      publicMethodsOnly - Transactional アノテーションのみを保持する public メソッド(通常はプロキシベースの AOP で使用)、または保護 / プライベートメソッドもサポートするかどうか (通常、AspectJ クラスのウィービングで使用されます)
    • AnnotationTransactionAttributeSource

      public AnnotationTransactionAttributeSource(TransactionAnnotationParser annotationParser)
      カスタム AnnotationTransactionAttributeSource を作成します。
      パラメーター:
      annotationParser - 使用する TransactionAnnotationParser
    • AnnotationTransactionAttributeSource

      public AnnotationTransactionAttributeSource(TransactionAnnotationParser... annotationParsers)
      カスタム AnnotationTransactionAttributeSource を作成します。
      パラメーター:
      annotationParsers - 使用する TransactionAnnotationParsers
    • AnnotationTransactionAttributeSource

      public AnnotationTransactionAttributeSource(SetSE<TransactionAnnotationParser> annotationParsers)
      カスタム AnnotationTransactionAttributeSource を作成します。
      パラメーター:
      annotationParsers - 使用する TransactionAnnotationParsers
  • メソッドの詳細

    • isCandidateClass

      public boolean isCandidateClass(ClassSE<?> targetClass)
      インターフェースからコピーされた説明: TransactionAttributeSource
      指定されたクラスが、この TransactionAttributeSource のメタデータ形式のトランザクション属性の候補であるかどうかを判別します。

      このメソッドが false を返す場合、指定されたクラスのメソッドは TransactionAttributeSource.getTransactionAttribute(java.lang.reflect.Method, java.lang.Class<?>) イントロスペクションのために走査されません。false を返すことは、影響を受けないクラスの最適化です。一方、true は、クラスが特定のクラスの各メソッドに対して個別に完全に内省する必要があることを意味します。

      次で指定:
      インターフェース TransactionAttributeSourceisCandidateClass 
      パラメーター:
      targetClass - 内省するクラス
      戻り値:
      クラスまたはメソッドレベルでトランザクション属性を持たないことがクラスに知られている場合は false。それ以外の場合は true。デフォルトの実装は true を返し、通常のイントロスペクションにつながります。
    • findTransactionAttribute

      @Nullable protected TransactionAttribute findTransactionAttribute(ClassSE<?> clazz)
      クラスからコピーされた説明: AbstractFallbackTransactionAttributeSource
      サブクラスは、特定のクラスのトランザクション属性があれば、それを返すためにこれを実装する必要があります。
      次で指定:
      クラス AbstractFallbackTransactionAttributeSourcefindTransactionAttribute 
      パラメーター:
      clazz - 属性を取得するクラス
      戻り値:
      このクラスに関連付けられているすべてのトランザクション属性、または存在しない場合は null 
    • findTransactionAttribute

      @Nullable protected TransactionAttribute findTransactionAttribute(MethodSE method)
      クラスからコピーされた説明: AbstractFallbackTransactionAttributeSource
      サブクラスは、指定されたメソッドのトランザクション属性があればそれを返すためにこれを実装する必要があります。
      次で指定:
      クラス AbstractFallbackTransactionAttributeSourcefindTransactionAttribute 
      パラメーター:
      method - 属性を取得するメソッド
      戻り値:
      このメソッドに関連付けられたすべてのトランザクション属性。ない場合は null 
    • determineTransactionAttribute

      @Nullable protected TransactionAttribute determineTransactionAttribute(AnnotatedElementSE element)
      指定されたメソッドまたはクラスのトランザクション属性を決定します。

      この実装は、既知のアノテーションを Spring のメタデータ属性クラスに解析するために、構成済みの TransactionAnnotationParsers に委譲します。トランザクションでない場合、null を返します。

      トランザクションメタデータを運ぶカスタムアノテーションをサポートするためにオーバーライドできます。

      パラメーター:
      element - アノテーション付きのメソッドまたはクラス
      戻り値:
      設定されたトランザクション属性、または何も見つからなかった場合は null 
    • allowPublicMethodsOnly

      protected boolean allowPublicMethodsOnly()
      デフォルトでは、public メソッドのみをトランザクション対応にすることができます。
      オーバーライド:
      クラス AbstractFallbackTransactionAttributeSourceallowPublicMethodsOnly 
    • equals

      public boolean equals(@Nullable ObjectSE other)
      オーバーライド:
      クラス ObjectSEequalsSE 
    • hashCode

      public int hashCode()
      オーバーライド:
      クラス ObjectSEhashCode