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-projects-issues opened this issue Jun 17, 2017 · 2 comments
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants