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 springaop执行返回类型_Java_Spring_Aop_Aspectj - Fatal编程技术网

Java springaop执行返回类型

Java springaop执行返回类型,java,spring,aop,aspectj,Java,Spring,Aop,Aspectj,我 通过AspectJ拦截方法。我需要在切入点表达式执行(**.*(..)中添加返回类型TestObj。我该怎么做 @Around("@annotation(interceptor) && execution(* *.*(..)) && args(argType, ..)") public Object logAction(ProceedingJoinPoint joinPoint, Interceptor interceptor, TestObj argType

我 通过AspectJ拦截方法。我需要在切入点表达式
执行(**.*(..)
中添加返回类型TestObj。我该怎么做

@Around("@annotation(interceptor) && execution(* *.*(..)) && args(argType, ..)")
public Object logAction(ProceedingJoinPoint joinPoint, Interceptor interceptor, TestObj argType) throws Throwable {
    // do smth
}
execution()
表达式支持返回类型筛选。如果需要将返回类型设置为
TestObj
,或其任何子类型,则应使用以下方法:

@Around("@annotation(interceptor) && execution(* TestObj *.*(..)) && args(argType, ..)")
public Object logAction(ProceedingJoinPoint joinPoint, Interceptor interceptor, TestObj argType) throws Throwable {
你可以找到更多:

执行(public(@Immutable*)org.xyz.**(.)

在前缀为org.xyz的包中执行任何公共方法,其中该方法返回一个不可变的结果


第一个方法参数的类型是否与返回类型一样也是
TestObj
?或者这是一个错误,您实际上想要将返回值绑定到一个参数?因为
args()。我尝试执行(TestObj**(..),但acpect不拦截我的函数