[英]Compile-time weaving configuration
我正在尝试将我的加载时编织 aspectj 转换为编译时编织。
所以我从我的 spring 配置中删除了<context:load-time-weaver/>
,并在我的pom.xml
添加了一个 aspectj 编译器。 但我不知道如何转换META-INF/aop.xml
。
我在那里有这样的东西:
<!DOCTYPE aspectj PUBLIC
"-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<weaver>
<!-- only weave classes in this package -->
</weaver>
<aspects>
<!-- use only this aspect for weaving -->
<concrete-aspect name="MyAspect_" extends="hu.myAspect">
<pointcut name="pointcut" expression="execution(public * javax.persistence.EntityManager.*(..)) || execution(public * hu..*.create(..))"/>
</concrete-aspect>
</aspects>
</aspectj>
在编译时编织中没有与 aop.xml 完全等效的内容,但是您可以配置AspectJ maven 插件以包含和排除某些方面,例如
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<includes>
<include>**/TransationAspect.java</include>
<include>**/SecurityAspect.aj</include>
</includes>
<excludes>
<exclude>**/logging/*.aj</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.