“JoinPoint對象封裝了SpringAop中切面方法的信息,在切面方法中添加JoinPoint參數,就可以獲取到封裝了該方法信息的JoinPoint對象. ”
JoinPoint適用於注解和Schema形式
注意: 不是Joinpoint 而是 JoinPoint !! 如果寫成Joinpoint 會報錯 “error at ::0 formal unbound in pointcut ”
@Before("execution(方法)")
public void myBefore(JoinPoint jp){ //通過這個參數可以獲取目標方法的參數 屬性
System.out.println("方法所在類:"+ jp.getTarget() + "\t方法名稱"+jp.getSignature().getName());
System.out.println("這里是通過注解實現的前置通知");
}