You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AspectJ execution pointcut does not detect methods in superinterface anymore [SPR-16723] #21264
It looks like the pointcut ignores methods that are declared only in a super interface. If I actually override the methods in my MongoRepository, the advice is applied.
A workaround for this is to use the interface where the method is actually declared as a execution pointcut, and specify the target separately:
This turns out to be a side effect of 5.0.5's changes for more efficient proxy treatment: #21216 and more specifically for this issue here #21218. AspectJ is unable to evaluate pointcuts that refer to methods against an interface with the method actually declared on a superinterface... but previously we nevertheless detected them on the concrete class that we were also checking, and that AspectJ introspects fine even for such interface-declared methods. This is still the case for regular classes but not for dynamic interface proxies where we thought we could skip the generated proxy class since it won't reveal any more methods than the interfaces do already... It seems we'll have to re-add that defensive check against the proxy class, even if effectively just needed for AspectJ pointcuts.
So overall, this is quite specific to Spring Data with its runtime-generated interface proxies with a multi-level inheritance hierarchy. I've got a working fix for master and will backport it to 5.0.x ASAP, for release in 5.0.6 in about two weeks (to be picked by Boot 2.0.2 right away).
While this regression is rather specific to Spring Data, there is a generally issue uncovered through it: AspectJ pointcut evaluation doesn't understand such subinterface references to methods on superinterfaces if they are not redeclared further down the hierarchy (e.g. on a subinterface or on the concrete class). This involves dynamic proxies with interface inheritance (like in the case above which worked in older versions as a side effect) but also Java 8 default methods on interfaces for regular bean classes (which never worked with such pointcuts).
For 5.0.6, I'm trying to address the underlying issue rather than reverting the optimization that caused the immediate regression in 5.0.5.
I've pushed my revision for 5.1 and 5.0.6. Please give an upcoming 5.1.0.BUILD-SNAPSHOT or 5.0.6.BUILD-SNAPSHOT a try and let me know whether it works for you...
Activity
spring-projects-issues commentedon Apr 13, 2018
Juergen Hoeller commented
This turns out to be a side effect of 5.0.5's changes for more efficient proxy treatment: #21216 and more specifically for this issue here #21218. AspectJ is unable to evaluate pointcuts that refer to methods against an interface with the method actually declared on a superinterface... but previously we nevertheless detected them on the concrete class that we were also checking, and that AspectJ introspects fine even for such interface-declared methods. This is still the case for regular classes but not for dynamic interface proxies where we thought we could skip the generated proxy class since it won't reveal any more methods than the interfaces do already... It seems we'll have to re-add that defensive check against the proxy class, even if effectively just needed for AspectJ pointcuts.
So overall, this is quite specific to Spring Data with its runtime-generated interface proxies with a multi-level inheritance hierarchy. I've got a working fix for master and will backport it to 5.0.x ASAP, for release in 5.0.6 in about two weeks (to be picked by Boot 2.0.2 right away).
spring-projects-issues commentedon Apr 14, 2018
Juergen Hoeller commented
While this regression is rather specific to Spring Data, there is a generally issue uncovered through it: AspectJ pointcut evaluation doesn't understand such subinterface references to methods on superinterfaces if they are not redeclared further down the hierarchy (e.g. on a subinterface or on the concrete class). This involves dynamic proxies with interface inheritance (like in the case above which worked in older versions as a side effect) but also Java 8 default methods on interfaces for regular bean classes (which never worked with such pointcuts).
For 5.0.6, I'm trying to address the underlying issue rather than reverting the optimization that caused the immediate regression in 5.0.5.
spring-projects-issues commentedon Apr 14, 2018
Juergen Hoeller commented
I've pushed my revision for 5.1 and 5.0.6. Please give an upcoming
5.1.0.BUILD-SNAPSHOTor5.0.6.BUILD-SNAPSHOTa try and let me know whether it works for you...