使用 Spring AOP 理解 AspectJ 风格

Understanding AspectJ style with Spring AOP

我正在阅读 spring documentation 有关 AOP 的内容,现在我正在阅读有关使用 @AspectJ 样式的部分。

Spring AOP is implemented in pure Java. There is no need for a special compilation process. Spring AOP does not need to control the class loader hierarchy, and is thus suitable for use in a Servlet container or application server.

但是在关于 @AspectJ 样式的部分中说

The @AspectJ support can be enabled with XML or Java style configuration. In either case you will also need to ensure that AspectJ’s aspectjweaver.jar library is on the classpath of your application (version 1.6.8 or later).

据我所知,aspectjweaver.jar 在编译时或加载时执行方面的实际编织。但是 Spring 有自己的基于代理的实现。所以我真的看不出 aspectjweaver.jar 依赖的任何原因。

没错,要使用 @Aspect 注释,我们需要 aspectjrt 依赖项。但是我不清楚对编织者的依赖。您不能简单地解释一下它的实际工作原理吗?

Spring AOP 本身不使用 AspectJ 编织器,但它重用了 aspectjweaver.jar 文件中的一些 类。它用于定义 AspectJ 风格的切入点表达式,例如@Before.