3

I’m trying to use aspect seaving in my Maven/Spring (3.2.11.RELEASE) project. I have this configured for my plugin …

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <configuration>
                <complianceLevel>1.6</complianceLevel>
                <aspectLibraries>
                    <aspectLibrary>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-aspects</artifactId>
                    </aspectLibrary>
                </aspectLibraries>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

and here’s my aspects dependencies …

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.8.2</version>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.8.2</version>
    </dependency>

but when I run “mvn clean install” I get these warnings …

[INFO] --- aspectj-maven-plugin:1.7:compile (default) @ pd ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[WARNING] advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]
    /Users/davea/.m2/repository/org/springframework/spring-aspects/3.2.11.RELEASE/spring-aspects-3.2.11.RELEASE.jar!org/springframework/scheduling/aspectj/AbstractAsyncExecutionAspect.class:58

[WARNING] advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
    /Users/davea/Dropbox/workspace/pd/org/springframework/mock/staticmock/AnnotationDrivenStaticEntityMockingControl.aj:83

[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
    /Users/davea/.m2/repository/org/springframework/spring-aspects/3.2.11.RELEASE/spring-aspects-3.2.11.RELEASE.jar!org/springframework/mock/staticmock/AbstractMethodMockingControl.class:190

[WARNING] advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
    /Users/davea/.m2/repository/org/springframework/spring-aspects/3.2.11.RELEASE/spring-aspects-3.2.11.RELEASE.jar!org/springframework/mock/staticmock/AbstractMethodMockingControl.class:199

How do I resolve dependencies properly so that these warnings go away?

Edit: This is the configuration I have set up in my spring WEB-INF/dispatcher-servlet.xml file. I'm trying to make a private method @Transactional ...

<bean class="org.springframework.transaction.aspectj.AnnotationTransactionAspect" factory-method="aspectOf">
    <property name="transactionManager" ref="transactionManager"/>
</bean>

<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
<tx:advice id="txAdvice" >
    <tx:attributes>
        <tx:method name="generateAccess" propagation="REQUIRED"/>
    </tx:attributes>
</tx:advice>
<aop:config>
    <aop:pointcut id="orderServicePC" expression="execution(* org.mainco.subco.myproject.service.OrderService.*(..))" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="orderServicePC" />
</aop:config>
Dave
  • 15,639
  • 133
  • 442
  • 830
  • Fixed in Spring 4.1.2: https://jira.spring.io/browse/SPR-12239 – Jukka Oct 31 '14 at 20:32
  • The warnings you are getting mean that an advice defined in an an aspect is not used. Often this problem is not related to project dependencies, but simply to errors in the definition of pointcuts. If you could post the relevant code, it would be possible to check and eventually rule that out. – Raul Bertone Nov 01 '14 at 15:30
  • I added the advice configuration I placed in one of my spring context file. Let me know if it is malformed or if it needs to go somewhere else. – Dave Nov 03 '14 at 16:12

0 Answers0