|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.context.event.EventPublicationInterceptor
public class EventPublicationInterceptor
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
Field Summary | |
---|---|
private java.lang.reflect.Constructor |
applicationEventClassConstructor
|
private ApplicationEventPublisher |
applicationEventPublisher
|
Constructor Summary | |
---|---|
EventPublicationInterceptor()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
java.lang.Object |
invoke(MethodInvocation invocation)
|
void |
setApplicationEventClass(java.lang.Class applicationEventClass)
Set the application event class to publish. |
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Set the ApplicationEventPublisher that this object runs in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.reflect.Constructor applicationEventClassConstructor
private ApplicationEventPublisher applicationEventPublisher
Constructor Detail |
---|
public EventPublicationInterceptor()
Method Detail |
---|
public void setApplicationEventClass(java.lang.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.
java.lang.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)
ApplicationEventPublisherAware
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
in interface ApplicationEventPublisherAware
applicationEventPublisher
- event publisher to be used by this objectpublic void afterPropertiesSet() throws java.lang.Exception
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
java.lang.Exception
- in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.public java.lang.Object invoke(MethodInvocation invocation) throws java.lang.Throwable
java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |