A failure to commit a reactive transaction will complete the transaction and clean up resources. Executing a rollback at that point is invalid, which causes an IllegalTransactionStateException that masks the cause of the commit failure.

This change restructures TransactionalOperatorImpl and ReactiveTransactionSupport to avoid executing a rollback after a failed commit. While there, the Mono transaction handling in TransactionalOperator is simplified by moving it to a default method on the interface.

See gh-27523

Comment From: sdeleuze

@mp911de Could you please review the latest version of this PR and confirm (or not) you are ok for merging it (I will also have a deeper look after your confirmation)?

Comment From: sdeleuze

@EnricSala I have rebased the branch on top of main in https://github.com/sdeleuze/spring-framework/tree/gh-27523, but I see an error in CoroutinesTransactionInterceptorTests, could you please have a look and maybe rebased this PR on top of main potentially using my branch as a basis?

Comment From: EnricSala

@sdeleuze I have rebased this PR on top of main and added a commit to fix CoroutinesTransactionInterceptorTests. Please check if this small fix makes sense :)

Comment From: sdeleuze

Merged via edf0ae77e502dd0e5b85a4fa8fc08d3e516d990a after @simonbasle and @mp911de green light. Thanks for contributing this and for your patience @EnricSala. Please test snapshots to check everything looks fine for your use cases.