public class EventPublicationInterceptor extends ObjectSE implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean
ApplicationEventPublisher で登録されたすべての ApplicationListeners に ApplicationEvent を発行する Interceptor は、各メソッド呼び出しが成功した後。 このインターセプターは、"applicationEventClass" プロパティを介して構成されたステートレスイベントのみを発行できることに注意してください。
setApplicationEventClass(java.lang.Class<?>), ApplicationEvent, ApplicationListener, ApplicationEventPublisher, ApplicationContext| コンストラクターと説明 |
|---|
EventPublicationInterceptor() |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | afterPropertiesSet() 指定されたすべての Bean プロパティを設定した(そして BeanFactoryAware と ApplicationContextAware を満たした)後に BeanFactory によって呼び出されます。 |
ObjectSE | invoke(MethodInvocation invocation) このメソッドを実装して、呼び出しの前後に追加の処理を実行します。 |
void | setApplicationEventClass(ClassSE<?> applicationEventClass) 公開するアプリケーションイベントクラスを設定します。 |
void | setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) このオブジェクトが実行される ApplicationEventPublisher を設定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic void setApplicationEventClass(ClassSE<?> applicationEventClass)
イベントクラスに は、イベントソースの単一の Object 引数を持つコンストラクターが必要です。インターセプターは、呼び出されたオブジェクトを渡します。
IllegalArgumentExceptionSE - 指定された Class が null である場合、または ApplicationEvent サブクラスではない場合、単一の Object 引数を取るコンストラクターを公開していない場合 public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
ApplicationEventPublisherAware通常の Bean プロパティの設定後、InitializingBean の afterPropertiesSet などの init コールバックやカスタム init メソッドの前に呼び出されます。ApplicationContextAware の setApplicationContext の前に呼び出されます。
ApplicationEventPublisherAware の setApplicationEventPublisher applicationEventPublisher - このオブジェクトによって使用されるイベント発行元 public void afterPropertiesSet()
throws ExceptionSEInitializingBeanこのメソッドにより、Bean インスタンスは、すべての Bean プロパティが設定されている場合にのみ可能な初期化を実行し、設定ミスの場合に例外をスローできます。
InitializingBean の afterPropertiesSet ExceptionSE - 設定ミス(必須プロパティの設定の失敗など)が発生した場合、または初期化が失敗した場合。public ObjectSE invoke(MethodInvocation invocation) throws ThrowableSE
MethodInterceptorJoinpoint.proceed() を呼び出すようにします。MethodInterceptor の invoke invocation - メソッド呼び出しジョインポイント Joinpoint.proceed() の呼び出しの結果。インターセプターによってインターセプトされる可能性があります ThrowableSE - インターセプターまたはターゲットオブジェクトが例外をスローする場合