我有两个aspect.java,但只想使用其中一个。所以我使用includes标记,它不工作,使用exclude标记是工作,我使用命令是(mvn clean compile),配置如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<showWeaveInfo>true</showWeaveInfo>
<sources>
<source>
<basedir>src/main/java</basedir>
<includes>
<include>**/MethodEndAspect.java</include>
</includes>
</source>
</sources>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
metheodendaspect.class代码是
@Aspect
public class MethodEndAspect {
@Before("execution(* com.test.service.UserServiceEnd.fetchUserById(..))")
public void setStartTimeInThreadLocal() {
System.out.println("before ...");
}
}
错误是:
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[WARNING] advice defined in com.test.aspects.MethodEndAspect has not been applied
[Xlint:adviceDidNotMatch]
D:\SourceCode\ideaWorkspace\aspectj-demo\aspectj-demo\src\main\java\com\test\aspects\MethodEndAspect.java:27
在此处输入图像描述
暂无答案!
目前还没有任何答案,快来回答吧!