Spring 2.5版 AspectJ 1.7版
面对Pointcut表达式的问题
$ ./bin/array2d_swap_row
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0
2 2 2 2 2 2 2 2 2 2
以下是我的Aspect课程:
@Pointcut("within(com.test.service..*)")
配置正确,因为我能够执行:
package com.test.aspect.controller;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
public class ControllerAspects {
@Before("publicOperationInService()")
public void log(){
System.out.println("**********anyPublicOperationInService()**********");
}
@Before("anyPublicOperation()")
public void publicOp(){
System.out.println("**********anyPublicOperation()**********");
}
@Pointcut("execution(public * *(..))")
private void anyPublicOperation() {}
@Pointcut("within(com.test.service..*)")
private void inService() {}
@Pointcut("anyPublicOperation() && inService()")
public void publicOperationInService() {}
}
感谢。