The docs explain that, the LTW has to enabled either through the use of <context:load-time-weaver/>
xml instruction or the use of @EnableLoadTimeWeaving
annotation. However, I have done neither, but I still see that aspects are woven correctly in my projects!
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:
public
members only (private
/protected
can't be intercepted)this
or super
)If you want to be able to advise fields for example, you would need to enable the use of Native AspectJ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With