一. 捕获何时执行通知
        
使用adviceexecution()切入点。adviceexecution()切入点的语法如下:
        pointcut <pointcut name>() : adviceexecution();
package  com.aspectj;

public  aspect AdviceExecutionRecipe 
{
   
/**//*
       Specifies calling advice whenever advice is executed
   
*/

   pointcut adviceExecutionPointcut() : adviceexecution();

   
// Advice declaration
   before() : adviceExecutionPointcut()
   
{
      System.out.println(
         
"------------------- Aspect Advice Logic --------------------");
      System.out.println(
"In the advice picked by ExecutionRecipe");
      System.out.println(
         
"Signature: "
            
+ thisJoinPoint.getStaticPart().getSignature());
      System.out.println(
         
"Source Line: "
            
+ thisJoinPoint.getStaticPart().getSourceLocation());
      System.out.println(
         
"------------------------------------------------------------");
   }

}


二. 排出作为通知执行结果的连接点
三. 在发出通知时展示原始连接点
        
添加JoinPoint标识符到切入点定义中。
package  com.aspectj;

import  org.aspectj.lang.JoinPoint;

public  aspect AdviceExecutionRecipe 
{
   
/**//*
       Specifies calling advice whenever advice is executed
   
*/

   pointcut adviceExecutionPointcut(JoinPoint originalJoinPoint) : adviceexecution() 
&& args(originalJoinPoint) && !within(AdviceExecutionRecipe);

   
// Advice declaration
   before(JoinPoint originalJoinPoint) : adviceExecutionPointcut(originalJoinPoint)
   
{
      System.out.println(
         
"------------------- Aspect Advice Logic --------------------");
      System.out.println(
"In the advice picked by AdviceExecutionRecipe");
      System.out.println(
         
"Signature: "
            
+ thisJoinPoint.getStaticPart().getSignature());
      System.out.println(
         
"Source Line: "
            
+ thisJoinPoint.getStaticPart().getSourceLocation());
      
      System.out.println(
            
"Advised Advice's Join Point Signature: "
               
+ originalJoinPoint.getSignature());
      
      System.out.println(
         
"------------------------------------------------------------");
   }

}