You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and {api-spring-framework}/context/event/SimpleApplicationEventMulticaster.html[`SimpleApplicationEventMulticaster`]
8562
+
implementation for configuration options.
8557
8563
8558
8564
The following example shows the bean definitions used to register and configure each of
8559
8565
the classes above:
@@ -8595,7 +8601,7 @@ architectures that build upon the well-known Spring programming model.
8595
8601
==== Annotation-based Event Listeners
8596
8602
8597
8603
As of Spring 4.2, you can register an event listener on any public method of a managed
8598
-
bean by using the `EventListener` annotation. The `BlackListNotifier` can be rewritten as
8604
+
bean by using the `@EventListener` annotation. The `BlackListNotifier` can be rewritten as
8599
8605
follows:
8600
8606
8601
8607
[source,java,indent=0]
@@ -8661,19 +8667,20 @@ items made available to the context so that you can use them for conditional eve
8661
8667
| Event
8662
8668
| root object
8663
8669
| The actual `ApplicationEvent`.
8664
-
| `#root.event`
8670
+
| `#root.event` or `event`
8665
8671
8666
8672
| Arguments array
8667
8673
| root object
8668
-
| The arguments (as array) used for invoking the target.
8669
-
| `#root.args[0]`
8674
+
| The arguments (as an object array) used to invoke the method.
8675
+
| `#root.args` or `args`; `args[0]` to access the first argument, etc.
8670
8676
8671
8677
| __Argument name__
8672
8678
| evaluation context
8673
8679
| The name of any of the method arguments. If, for some reason, the names are not available
8674
-
(for example, because there is no debug information), the argument names are also available under the `#a<#arg>`
8675
-
where `#arg` stands for the argument index (starting from 0).
8676
-
| `#blEvent` or `#a0` (you can also use `#p0` or `#p<#arg>` notation as an alias)
8680
+
(for example, because there is no debug information in the compiled byte code), individual
8681
+
arguments are also available using the `#a<#arg>` syntax where `<#arg>` stands for the
8682
+
argument index (starting from 0).
8683
+
| `#blEvent` or `#a0` (you can also use `#p0` or `#p<#arg>` parameter notation as an alias)
8677
8684
|===
8678
8685
8679
8686
Note that `#root.event` gives you access to the underlying event, even if your method
@@ -8719,11 +8726,12 @@ following example shows how to do so:
8719
8726
8720
8727
Be aware of the following limitations when using asynchronous events:
8721
8728
8722
-
* If the event listener throws an `Exception`, it is not propagated to the caller
8723
-
See `AsyncUncaughtExceptionHandler` for more details.
8724
-
* Such event listener cannot send replies. If you need to send another event as the
8725
-
result of the processing, inject {api-spring-framework}/aop/interceptor/AsyncUncaughtExceptionHandler.html[`ApplicationEventPublisher`] to send the event
8726
-
manually.
8729
+
* If an asynchronous event listener throws an `Exception`, it is not propagated to the
8730
+
caller. See `AsyncUncaughtExceptionHandler` for more details.
8731
+
* Asynchronous event listener methods cannot publish a subsequent event by returning a
8732
+
value. If you need to publish another event as the result of the processing, inject an
0 commit comments