public class EventPublicationInterceptor extends Object implements org.aopalliance.intercept.MethodInterceptor, ApplicationEventPublisherAware, org.springframework.beans.factory.InitializingBean
Interceptor 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.
setApplicationEventClass(java.lang.Class<?>),
ApplicationEvent,
ApplicationListener,
ApplicationEventPublisher,
ApplicationContext| 构造器和说明 |
|---|
EventPublicationInterceptor() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterPropertiesSet() |
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation) |
void |
setApplicationEventClass(Class<?> applicationEventClass)
Set the application event class to publish.
|
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Set the ApplicationEventPublisher that this object runs in.
|
public void setApplicationEventClass(Class<?> applicationEventClass)
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 argumentpublic void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
ApplicationEventPublisherAwareInvoked 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 在接口中 ApplicationEventPublisherAwareapplicationEventPublisher - event publisher to be used by this objectpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBeanException