@Target(value={METHOD,ANNOTATION_TYPE})
@Retention(value=RUNTIME)
@Documented
public @interface EventListener
ApplicationEvent
instances
as well as arbitrary objects.
Processing of @EventListener
annotations is performed via
EventListenerMethodProcessor
that is registered automatically
when using Java config or via the <context:annotation-driven/>
XML element.
Annotated methods may have a non-void
return type. When they
do, the result of the method invocation is sent as a new event. It is
also possible to defined the order in which listeners for a certain
event are invoked. To do so, add a regular {code @Order} annotation
alongside this annotation.
While it is possible to define any arbitrary exception types, checked
exceptions will be wrapped in a UndeclaredThrowableException
as the caller only handles runtime exceptions.
EventListenerMethodProcessor
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
condition
Spring Expression Language (SpEL) attribute used for making the event
handling conditional.
|