2

我正在尝试将我的加载时间编织 aspectj 转换为编译时间编织。

所以我<context:load-time-weaver/>从我的 spring 配置中删除,并在我的pom.xml. 但我不知道如何将信息转换为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>
4

1 回答 1

5

在编译时编织中没有与 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>
于 2010-09-22T09:37:06.713 回答