Returning a CompletableFuture.failure()
from an async, transactional method should mark the transaction as roll back
#30018
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Returning a value from an
@Async
method usually involves aCompletableFuture
wrapper of the value. If such a method is declared like this:The failed
CF
could be the result of handling an exception as we might not want to bubble up the async execution exception handling chain, but rather hand into the client so that it can react to the failure by e.g.….exceptionally(…)
.Unfortunately, for transactional methods, returning that failed
CF
instance would not roll back the transaction, as that currently only reacts to exceptions being thrown and VavrFailure
instances. FailedCF
instances are actually very similar to the latter, which is why it would be nice if our transaction handling worked the same when returning failedCF
s.The text was updated successfully, but these errors were encountered: