@TransactionalEventListener
does not work with SimpleApplicationEventMulticaster.setTaskExecutor
#30244
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
in: data
Issues in data modules (jdbc, orm, oxm, tx)
type: enhancement
A general enhancement
Milestone
If the ApplicationEventMulticaster bean appears in the context, the @TransactionalEventListener annotation is useless, it will not work a priori and is not mentioned anywhere.
At the stage of this method, there is still a transaction in the publish event call chain, SimpleApplicationEventMulticaster.multicastEvent:
If we have an ApplicationEventMulticaster bean, then the first if will be executed and invokeListener will be executed deferred in a separate thread WHERE OUR TRANSACTION WILL NOT BE ALREADY.
Here's what's happening in invokeListener -> doInvokeListener -> TransactionalApplicationListenerMethodAdapter.onApplicationEvent():
When this code is executed asynchronously in a separate thread (executor), the transaction no longer exists.
The text was updated successfully, but these errors were encountered: