Caused by: java.lang.IllegalArgumentException: ::0 切入点正式未绑定错误

Caused by: java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut

我已经检查过类似这样的其他 SO 问题,但 none 似乎适用。

我有我的服务class:

package com.test.demo.service;

import com.test.demo.controller.Controller2;
import com.test.demo.model.SettlementTransaction;
import org.springframework.stereotype.Service;

@Service
public class TestService {

    public Controller2.AcctDetails testAcctDeets(Transaction transaction){

还有我的方面:

@AfterReturning(pointcut = "execution(* com.test.demo.service.TestService.testAcctDeets(..))", returning = "response")
public void interceptRequest(Controller2.AcctDetails response, JoinPoint thisJoinPoint) {
    System.out.println(thisJoinPoint);
    for (Object arg : thisJoinPoint.getArgs()) {
        if (arg instanceof String)
            System.out.println("  request = " + arg);
    }
    System.out.println("  response = " + response.toString());
}

但我一直收到错误消息:

Caused by: java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut

感谢任何帮助。谢谢!

来自参考文档:Access to the Current

Any advice method may declare, as its first parameter, a parameter of type org.aspectj.lang.JoinPoint (note that around advice is required to declare a first parameter of type ProceedingJoinPoint, which is a subclass of JoinPoint

这被记录为主题 Advice Parameters 的延续,它引用了这个:Spring 提供完整类型的建议,这意味着您声明建议签名中需要的参数(正如我们之前看到的返回和抛出示例).

一起阅读时,当传递通知参数并且通知方法也有 JointPoint 或其任何子类作为另一个参数时,后者应声明为第一个参数。

所以在这种情况下,有效的方法签名将是

@AfterReturning(pointcut = "execution(* com.test.demo.service.TestService.testAcctDeets(..))", returning = "response")
public void interceptRequest(JoinPoint thisJoinPoint, Controller2.AcctDetails response) {
    // ..
}