Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring AOP:@AfterReturning建议混乱(s)_Java_Spring_Spring Aop - Fatal编程技术网

Java Spring AOP:@AfterReturning建议混乱(s)

Java Spring AOP:@AfterReturning建议混乱(s),java,spring,spring-aop,Java,Spring,Spring Aop,如上所述,在返回建议后,我试图通过以下方式声明一个: @Pointcut("execution(* package.method(..))") public void onComplete() { } 我的疑问如下: 返回后传递给@的值和切入点属性之间有什么区别 两个(值和切入点)中的哪一个是默认值 何时将JoinPoint参数传递给通知,何时不传递?有什么规则或情况吗?我看到过一些示例,这些示例是用outJoinPoint定义的。但当我试图将JoinPoint传递给callOnComple

如上所述,在返回建议后,我试图通过以下方式声明一个

@Pointcut("execution(* package.method(..))")
public void onComplete() {
}
我的疑问如下:

  • 返回后传递给
    @的
    切入点
    属性之间有什么区别
  • 两个(
    切入点
    )中的哪一个是默认值
  • 何时将
    JoinPoint
    参数传递给通知,何时不传递?有什么规则或情况吗?我看到过一些示例,这些示例是用out
    JoinPoint
    定义的。但当我试图将
    JoinPoint
    传递给
    callOnCompletion(…)
    方法时,我在切入点中得到了
    正式解除绑定…
    初始化时出错
  • void
    返回类型是否需要参数
    returnValue
  • 对于那些实际返回值的方法,参数
    returnValue
    是否是必需的
//Sample 1      
@AfterReturning(value="onComplete()",
                returning="returnValue")
public void callOnCompletion(Object returnValue){               
    // aditional code here ..
}

//Sample 2
@AfterReturning(pointcut="onComplete()",
                returning="returnValue")
public void callOnCompletion(Object returnValue){               
    // aditional code here ..
}

//Sample 1 with JoinPoint
@AfterReturning(value="onComplete()",
                returning="returnValue")
public void callOnCompletion(JoinPoint jp, Object returnValue){               
    // aditional code here ..
}

//Sample 2 with JoinPoint
@AfterReturning(pointcut="onComplete()",
                returning="returnValue")
public void callOnCompletion(JoinPoint jp, Object returnValue){               
    // aditional code here ..
}