AspectJ
AspectJ is a very good AOP framework that extends the Java language and defines a set of SOP syntax. Therefore, Java projects that use AspectJ need to use the compiler AJC provided by AspectJ instead of Javac. AspectJ programming is available in two ways, using extended syntax or using annotations. 、
When using AspectJ alone in a Java project, projects that use MAVEN management need to rely on: Aspectjrt.jar provides the AspectJ runtime class library. Aspectjweaver.jar provides a dependency on the AspectJ annotation method. Aspectjtools.jar provides a compilation environment. Spring AOP
Because AspectJ is excellent, Spring AOP draws on the AspectJ project and provides partial support for AspectJ annotation-driven facets. Spring AOP's annotation syntax is exactly the same as AspectJ, but spring AOP supports only a subset of annotations. With spring AOP, there are two ways of configuring and slicing: XML and annotation declarations. You do not need to rely on AspectJ for any packages that use XML methods, and you need to rely on Aspectjweaver.jar when using annotations. Both of these methods use Javac as the compiler. Both of these methods only need to be compiled with Javac.
In addition, Spring provides proxy-based classic spring AOP and pure POJO facets, but because of their cumbersome syntax, AspectJ-based AOP support is provided in the new spring version, and the old way has been discarded. differences and linkages between Spring AOP and AspectJ Spring AOP, while syntactically referencing the annotated declaration of AspectJ, is still created and managed by the Spring IoC container in the implementation or spring-based dynamic proxy. In Spring AOP, slices are implanted at run time, which is the method of creating a dynamic proxy object that wraps the actual call. AspectJ is compiled with a compile-time implant, so it needs to be compiled using the compiler provided by AspectJ. In addition, AspectJ 5 also provides a way to implant the class during loading. When you use AspectJ alone, you can use the dependency injection method that Spring provides when you want to rely on member variables for facets.