Skip to content

Commit 1240fb6

Browse files
committed
Consistently publish events from CompletableFuture
Closes gh-30578 (cherry picked from commit b738a20)
1 parent 7dae3af commit 1240fb6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ else if (result instanceof CompletionStage) {
274274
handleAsyncError(ex);
275275
}
276276
else if (event != null) {
277-
publishEvent(event);
277+
publishEvents(event);
278278
}
279279
});
280280
}
@@ -468,6 +468,9 @@ public String toString() {
468468
}
469469

470470

471+
/**
472+
* Inner class to avoid a hard dependency on the Reactive Streams API at runtime.
473+
*/
471474
private class ReactiveResultHandler {
472475

473476
public boolean subscribeToPublisher(Object result) {
@@ -481,6 +484,9 @@ public boolean subscribeToPublisher(Object result) {
481484
}
482485

483486

487+
/**
488+
* Reactive Streams Subscriber for publishing follow-up events.
489+
*/
484490
private class EventPublicationSubscriber implements Subscriber<Object> {
485491

486492
@Override

0 commit comments

Comments
 (0)