spring-framework / org.springframework.context.event / EventPublicationInterceptor

EventPublicationInterceptor

open class EventPublicationInterceptor : MethodInterceptor, ApplicationEventPublisherAware, InitializingBean

MethodInterceptor that publishes an ApplicationEvent to all ApplicationListeners registered with an ApplicationEventPublisher after each successful method invocation.

Note that this interceptor is only capable of publishing stateless events configured via the "applicationEventClass" property.

Author
Dmitriy Kopylenko

Author
Juergen Hoeller

Author
Rick Evans

See Also
#setApplicationEventClassorg.springframework.context.ApplicationEventorg.springframework.context.ApplicationListenerorg.springframework.context.ApplicationEventPublisherorg.springframework.context.ApplicationContext

Constructors

<init>

EventPublicationInterceptor()

MethodInterceptor that publishes an ApplicationEvent to all ApplicationListeners registered with an ApplicationEventPublisher after each successful method invocation.

Note that this interceptor is only capable of publishing stateless events configured via the "applicationEventClass" property.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

invoke

open fun invoke(invocation: MethodInvocation): Any

setApplicationEventClass

open fun setApplicationEventClass(applicationEventClass: Class<*>): Unit

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.

setApplicationEventPublisher

open fun setApplicationEventPublisher(applicationEventPublisher: ApplicationEventPublisher): Unit