Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@EventListener's 'condition' doesn't work as expected with proxied beans [SPR-15678] #20237

Closed
spring-issuemaster opened this issue Jun 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jun 17, 2017

Andrey Osipov opened SPR-15678 and commented

I've tried to add @EventListener with 'condition' to my service, but condition doesn't work. One of service's methods is annotated with @Transactional. So it will proxied.
If I delete @Transacional - it works perfect.
I found a workaround - move @EventListener to interface.


Affects: 4.3.8

Reference URL: https://github.com/blaketsk/event-listener-bug-example

Referenced from: commits 8ad3c95, eb928ce

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 5, 2017

Juergen Hoeller commented

Good catch: ApplicationListenerMethodAdapter needs to find the annotation on the most specific method, which may be a target method behind an interface-based proxy. Fixed for 5.0 RC3 now, and to be backported to 4.3.10.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 20, 2018

Petr Stuchlik commented

Might be worth noting that this fix can have negative impact on performance, especially when emitting a lot of events to your proxied beans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.