我正在尝试将我的load-time-woven aspectj转换为compile-time-woven。
所以我从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>
答案 0 :(得分:4)
在编译时编织中没有与aop.xml完全等效的内容,但是您可以像这样配置AspectJ maven plugin到include and exclude certain aspects
<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>