2

I am trying to convert my load-time-woven aspectj to compile-time-woven.

So I removed <context:load-time-weaver/> from my spring config, and added an aspectj compiler to my pom.xml. But I don't know how to convert the info in META-INF/aop.xml.

I have something like this in there:

<!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>

1 Answer 1

5

There is no exact equivalent to aop.xml in compile-time weaving, but you can configure the AspectJ maven plugin to include and exclude certain aspects like this

<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>
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.