execution(返回值类型 包名.类名.方法名(参数列表))
package com.jt.aop;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class CacheAop {
@Pointcut("execution(* com.jt.service..*(..))")
public void pointCat(){
}
@Before("pointCat()")
public void after(){
System.out.println("我是qian置通知 ");
}
}
execution(* com.jt.service..*(..))
第一个*
代表任意的返回值类型
service..
代表service包下的所有子孙包
service..*
代表service包下的所有子孙包中的所有类
(..)
代表任意参数