类 EventPublicationInterceptor

java.lang.Object
cn.taketoday.context.event.EventPublicationInterceptor
所有已实现的接口:
Aware, InitializingBean, ApplicationEventPublisherAware, Advice, Interceptor, MethodInterceptor

public class EventPublicationInterceptor extends Object implements MethodInterceptor, ApplicationEventPublisherAware, InitializingBean
Interceptor that publishes an ApplicationEvent to all ApplicationListeners registered with an ApplicationEventPublisher after each successful method invocation.
从以下版本开始:
4.0 2021/12/3 10:11
作者:
Dmitriy Kopylenko, Juergen Hoeller, Rick Evans, Harry Yang
另请参阅:
  • 构造器详细资料

    • EventPublicationInterceptor

      public EventPublicationInterceptor()
  • 方法详细资料

    • setApplicationEventClass

      public void setApplicationEventClass(Class<?> applicationEventClass)
      Set the application event class to publish.

      The event class must have a constructor with a single Object argument for the event source. The interceptor will pass in the invoked object.

      抛出:
      IllegalArgumentException - if the supplied Class is null or if it is not an ApplicationEvent subclass or if it does not expose a constructor that takes a single Object argument
    • setApplicationEventSupplier

      public void setApplicationEventSupplier(@Nullable Supplier<?> applicationEventSupplier)
      Set the event object supplier.
    • setApplicationEventPublisher

      public void setApplicationEventPublisher(@NonNull ApplicationEventPublisher applicationEventPublisher)
      从接口复制的说明: ApplicationEventPublisherAware
      Set the ApplicationEventPublisher that this object runs in.

      Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.

      指定者:
      setApplicationEventPublisher 在接口中 ApplicationEventPublisherAware
      参数:
      applicationEventPublisher - event publisher to be used by this object
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      指定者:
      afterPropertiesSet 在接口中 InitializingBean
      抛出:
      Exception
    • invoke

      @Nullable public Object invoke(MethodInvocation invocation) throws Throwable
      指定者:
      invoke 在接口中 MethodInterceptor
      抛出:
      Throwable