クラス EventPublicationInterceptor
java.lang.ObjectSE
org.springframework.context.event.EventPublicationInterceptor
- 実装されているすべてのインターフェース:
Advice, Interceptor, MethodInterceptor, Aware, InitializingBean, ApplicationEventPublisherAware
public class EventPublicationInterceptor
extends ObjectSE
implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean
各
ApplicationEventPublisher で登録されたすべての ApplicationListeners に ApplicationEvent を発行する Interceptor は、各メソッド呼び出しが成功した後。 このインターセプターは、"applicationEventClass" プロパティを介して構成されたステートレスイベントのみを発行できることに注意してください。
- 作成者:
- Dmitriy Kopylenko, Juergen Hoeller, Rick Evans
- 関連事項:
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明voidinvoke(MethodInvocation invocation) このメソッドを実装して、呼び出しの前後に追加の処理を実行します。voidsetApplicationEventClass(ClassSE<?> applicationEventClass) 公開するアプリケーションイベントクラスを設定します。voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) このオブジェクトが実行される ApplicationEventPublisher を設定します。
コンストラクターの詳細
EventPublicationInterceptor
public EventPublicationInterceptor()
メソッドの詳細
setApplicationEventClass
公開するアプリケーションイベントクラスを設定します。イベントクラスに は、イベントソースの単一の
Object引数を持つコンストラクターが必要です。インターセプターは、呼び出されたオブジェクトを渡します。- 例外:
IllegalArgumentExceptionSE- 指定されたClassがnullである場合、またはApplicationEventサブクラスではない場合、単一のObject引数を取るコンストラクターを公開していない場合
setApplicationEventPublisher
インターフェースからコピーされた説明:ApplicationEventPublisherAwareこのオブジェクトが実行される ApplicationEventPublisher を設定します。通常の Bean プロパティの設定後、InitializingBean の afterPropertiesSet などの init コールバックやカスタム init メソッドの前に呼び出されます。ApplicationContextAware の setApplicationContext の前に呼び出されます。
- 次で指定:
- インターフェース
ApplicationEventPublisherAwareのsetApplicationEventPublisher - パラメーター:
applicationEventPublisher- このオブジェクトによって使用されるイベント発行元
afterPropertiesSet
インターフェースからコピーされた説明:InitializingBeanすべての Bean プロパティを設定し、BeanFactoryAware、ApplicationContextAwareなどを満たした後、包含BeanFactoryによって呼び出されます。このメソッドにより、Bean インスタンスは、すべての Bean プロパティが設定されたときに、その全体的な構成の検証と最終的な初期化を実行できます。
- 次で指定:
- インターフェース
InitializingBeanのafterPropertiesSet - 例外:
ExceptionSE- 構成の誤り(必須プロパティの設定の失敗など)の場合、またはその他の理由で初期化が失敗した場合
invoke
インターフェースからコピーされた説明:MethodInterceptorこのメソッドを実装して、呼び出しの前後に追加の処理を実行します。正しい実装としては、必ずJoinpoint.proceed()を呼び出すようにします。- 次で指定:
- インターフェース
MethodInterceptorのinvoke - パラメーター:
invocation- メソッド呼び出しジョインポイント- 戻り値:
Joinpoint.proceed()の呼び出しの結果。インターセプターによってインターセプトされる可能性があります- 例外:
ThrowableSE- インターセプターまたはターゲットオブジェクトが例外をスローする場合