spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
55.48k stars 37.71k forks source link

Accept ajc-compiled `@Aspect` classes for Spring AOP proxy usage #32793

Closed jhoeller closed 1 month ago

jhoeller commented 1 month ago

In order to ship @Aspect classes for usage with Spring AOP proxies as well as AspectJ load-time and compile-time weaving, they need to be fully compiled with ajc. This is the case for Micrometer's TimedAspect: https://github.com/micrometer-metrics/micrometer/issues/1149

Our isAspect() check in AbstractAspectJAdvisorFactory does not accept ajc-compiled classes since it assumes that those are classic aspect classes which are not suitable for usage with Spring AOP. Let's relax that check, we only really need isAspect() to tell us what we need to introspect; we do not need it to determine actual advice compatibility.