GH-483 - Let CompletionRegisteringAdvisor forward EventExternalized event.
This commit is contained in:
@@ -175,7 +175,10 @@ public class CompletionRegisteringAdvisor extends AbstractPointcutAdvisor {
|
||||
if (result instanceof CompletableFuture<?> future) {
|
||||
|
||||
return future
|
||||
.thenAccept(it -> markCompleted(method, argument))
|
||||
.thenApply(it -> {
|
||||
markCompleted(method, argument);
|
||||
return it;
|
||||
})
|
||||
.exceptionallyCompose(it -> {
|
||||
handleFailure(method, it);
|
||||
return CompletableFuture.failedFuture(it);
|
||||
|
||||
@@ -89,6 +89,14 @@ class CompletionRegisteringAdvisorUnitTests {
|
||||
verify(registry).markCompleted(any(), any());
|
||||
}
|
||||
|
||||
@Test // GH-483
|
||||
void exposesResultForCompletableFuture() throws Exception {
|
||||
|
||||
CompletableFuture<?> future = createProxyFor(bean).asyncWithResult(false);
|
||||
|
||||
assertThat(future.get()).isNotNull();
|
||||
}
|
||||
|
||||
private void assertCompletion(BiConsumer<SomeEventListener, Object> consumer) {
|
||||
assertCompletion(consumer, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user