类 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
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidinvoke(MethodInvocation invocation) voidsetApplicationEventClass(Class<?> applicationEventClass) Set the application event class to publish.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) Set the ApplicationEventPublisher that this object runs in.voidsetApplicationEventSupplier(Supplier<?> applicationEventSupplier) Set the event object supplier.
-
构造器详细资料
-
EventPublicationInterceptor
public EventPublicationInterceptor()
-
-
方法详细资料
-
setApplicationEventClass
Set the application event class to publish.The event class must have a constructor with a single
Objectargument for the event source. The interceptor will pass in the invoked object.- 抛出:
IllegalArgumentException- if the suppliedClassisnullor if it is not anApplicationEventsubclass or if it does not expose a constructor that takes a singleObjectargument
-
setApplicationEventSupplier
Set the event object supplier. -
setApplicationEventPublisher
public void setApplicationEventPublisher(@NonNull ApplicationEventPublisher applicationEventPublisher) 从接口复制的说明:ApplicationEventPublisherAwareSet 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
- 指定者:
afterPropertiesSet在接口中InitializingBean- 抛出:
Exception
-
invoke
- 指定者:
invoke在接口中MethodInterceptor- 抛出:
Throwable
-