Spring AOP does not rely on AspectJ byte code weaving. It just borrows the annotations used to define aspects from the AspectJ project. It is a separately implemented framework that uses run-time proxies to implement aspects. If you have <aop:aspectj-autoproxy />
in your application context then spring is using proxies to implement supported aspects defined on beans that are in the container.
Proxies can only achieve a sub-set of the full capabilities of the actual AspectJ system, basically advice that wraps methods. Due to their nature proxies have following limitations:
- interception on external calls only (while breaching proxy boundary)
- interception on
public
members only (private
/protected
can't be intercepted) - unawareness to local calls (or calls with
this
orsuper
)
If you want to be able to advise fields for example, you would need to enable the use of Native AspectJ.