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

Unnecessary proxying with MethodMapTransactionAttributeSource [SPR-16733] #21274

Closed
spring-projects-issues opened this issue Apr 17, 2018 · 2 comments
Assignees
Labels
in: core type: regression
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Apr 17, 2018

Rob Winch opened SPR-16733 and commented

The changes for in b5922f75 means that now unnecessary objects are proxied.

MethodMapTransactionAttributeSource now uses now uses ReflectionUtils.getAllDeclaredMethods which means that when something like addTransactionalMethod("sample.Foo.*", ...) is invoked, all the methods (including the methods on Object) are added to the transactionAttributeMap.

Then when a method from Object is queried on any class (i.e. MethodMapTransactionAttributeSource.getTransactionAttribute(finalizeMethod,JdbcTemplate.class)) the result is true, so every object ends up getting proxied.

A complete example of the issue can be seen at https://github.com/rwinch/spring-aop-proxy-issue/blob/master/src/test/java/sample/ProxyTests.java


Affects: 5.0.6

Issue Links:

  • #21264 AspectJ execution pointcut does not detect methods in superinterface anymore
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 17, 2018

Juergen Hoeller commented

Good point, this was just meant as a convenience for interface refactorings where methods happened to move to a super-interface. I'm afraid I forgot to consider ".*" patterns...

I'll simply revert to the previous implementation then and adapt the corresponding test case to explicitly refer to the super-interface. Whenever extracting a parent interface, people will simply have to adapt their method pattern the same way (as before).

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 18, 2018

Rob Winch commented

Thanks for the fast turnaround. I can confirm that the latest SNAPSHOTs have fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: regression
Projects
None yet
Development

No branches or pull requests

2 participants