Closed GoogleCodeExporter closed 9 years ago
We currently only support proxy based aspects, these work by replacing the
spring bean you register in your XML context with a proxy that handles the
aspect then delegates to your actual bean. The big problem with this approach
is that self-invocation does not go through the proxy.
So in you're example Spring creates a "ServiceProxy" wrapper for your Service
bean that intercepts calls to getInstitutionList and delegates to our
interceptor. When Spring is done wiring you app you have:
Caller -> ServiceProxy -> Service even though what it looks like you should
have by just reading your context config is Caller -> Service.
When Service calls one of its own methods it is just using the "this" reference
and has no idea that ServiceProxy exists or that calls coming from other
classes are using it.
The solution to this problem is for ehcache-spring-annotations to add AspectJ
weaving support. AspectJ weaving allows for either compile or load-time byte
code modification of .class files to add the interceptor call into the
annotated class instead of having a proxy layer. Unfortunately Nick and I
haven't ever played with AspectJ weaving before and currently don't have time
to really look into it. It is a feature we would like to have. I created Issue
64 as a general tracker for this functionality.
Original comment by eric.dalquist
on 25 Jan 2011 at 10:17
Understood. Thanks for the detailed explanation.
Original comment by mikeboy...@gmail.com
on 27 Jan 2011 at 2:47
Would be nice to mention it in the documentation. I spent quite some time today
trying to figure out why a half of my caches is not working.
Original comment by dzmitry....@gmail.com
on 4 Apr 2011 at 5:20
Original issue reported on code.google.com by
mikeboy...@gmail.com
on 25 Jan 2011 at 8:58