Compile/load time weaving with spring

自作多情 提交于 2019-11-30 21:54:13
Affe

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 or super)

If you want to be able to advise fields for example, you would need to enable the use of Native AspectJ.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!