AOP的三种实现
程序员文章站
2022-07-09 13:21:22
...
1、利用Spring AOP
2、所依赖的包是普通java编译,非aspectJ编译
3、所依赖的包用aspectJ编译过
2、所依赖的包是普通java编译,非aspectJ编译
<!-- 编译加强 --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.8</version> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> <configuration> <complianceLevel>1.7</complianceLevel> <source>1.7</source> <target>1.7</target> <weaveDependencies> <weaveDependency> <groupId>xx</groupId> <artifactId>yy</artifactId> </weaveDependency> </weaveDependencies> </configuration> </execution> </executions> </plugin>
3、所依赖的包用aspectJ编译过
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.8</version> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> <configuration> <complianceLevel>1.7</complianceLevel> <source>1.7</source> <target>1.7</target> <aspectLibraries> <aspectLibrary> <groupId>XX</groupId> <artifactId>YY</artifactId> <classifier>aspectj</classifier> </aspectLibrary> </aspectLibraries> </configuration> </execution> </executions> </plugin>
上一篇: 同一个java工程打两个不同的包
下一篇: 批量替换指令