Eric Bottard opened SPR-16004 and commented

When using @EventListener, it would be nice to have access to the current state of the bean instance that is owning the listener method. Case in point: my bean has a started boolean flag and should not listen when it is not started


No further details from SPR-16004

Comment From: snicoll

Thanks for the suggestion. Adding root.target to EventExpressionRootObject should do the trick and is more consistent with what we do in the cache abstraction.

Comment From: snicoll

Things are being a little bit harder to handle due to #31295 that is exposing a public API to evalute the condition and that method now need to take the bean instance into account.

Comment From: snicoll

All things considered, there are more flexibility in doing that in the @EventListener annotated method, especially as that started flag of your can remain private (and can't if you want to use it in SpEL).