diff --git a/spring-context/src/main/java/org/springframework/context/event/EventListener.java b/spring-context/src/main/java/org/springframework/context/event/EventListener.java index 9f4fefb4c5..6536e45929 100644 --- a/spring-context/src/main/java/org/springframework/context/event/EventListener.java +++ b/spring-context/src/main/java/org/springframework/context/event/EventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,7 +87,18 @@ public @interface EventListener { /** * Spring Expression Language (SpEL) attribute used for making the * event handling conditional. - *

Default is "", meaning the event is always handled. + *

Default is {@code ""}, meaning the event is always handled. + *

The SpEL expression evaluates against a dedicated context that + * provides the following meta-data: + *

*/ String condition() default ""; diff --git a/src/asciidoc/core-beans.adoc b/src/asciidoc/core-beans.adoc index 019bf10980..bfdb7447df 100644 --- a/src/asciidoc/core-beans.adoc +++ b/src/asciidoc/core-beans.adoc @@ -8314,8 +8314,8 @@ event is equal to `foo`: [source,java,indent=0] [subs="verbatim,quotes"] ---- - @EventListener(condition = "#event.test == 'foo'") - public void processBlackListEvent(BlackListEvent event) { + @EventListener(condition = "#blEvent.test == 'foo'") + public void processBlackListEvent(BlackListEvent blEvent) { // notify appropriate parties via notificationAddress... } ---- @@ -8328,22 +8328,22 @@ available to the context so one can use them for conditional event processing: |=== | Name| Location| Description| Example -| event +| Event | root object | The actual `ApplicationEvent` | `#root.event` -| args +| Arguments array | root object | The arguments (as array) used for invoking the target | `#root.args[0]` -| __argument name__ +| __Argument name__ | evaluation context | Name of any of the method arguments. If for some reason the names are not available (e.g. no debug information), the argument names are also available under the `#a<#arg>` where __#arg__ stands for the argument index (starting from 0). -| `#iban` or `#a0` (one can also use `#p0` or `#p<#arg>` notation as an alias). +| `#blEvent` or `#a0` (one can also use `#p0` or `#p<#arg>` notation as an alias). |=== Note that `#root.event` allows you to access to the underlying event, even if your method