SpringAOP配置声明式切面时报错error at ::0 formal unbound in pointcut

在配置aop时,切点表达式中写入了形参,在通知方法中,引入形参和JoinPoint 形参时,必须要把JoinPoint形参放置在第一位,否则会出现标题错误

@Component
@Aspect
public class RunCaseAspect {


    @Pointcut(value = "execution(* com.nonobank.testcase.service.impl.TestCaseRunServiceImpl.runCase(..)) && args(resultHistory, tcId, tciIds, map, sessionId)",
        argNames = "resultHistory, tcId, tciIds, map, sessionId")
    public void runCase(ResultHistory resultHistory, Integer tcId, List<Integer> tciIds,
        Map<String, Object> map, String sessionId) {}

    @Before("runCase(resultHistory, tcId, tciIds, map, sessionId)")
    public void beforeRunAll(JoinPoint joinPoint, ResultHistory resultHistory, Integer tcId, List<Integer> tciIds,
        Map<String, Object> map, String sessionId) {
        System.out.println("beforeRunAll .... tcId = " + tcId);
    }

    @AfterReturning(value = "runCase(resultHistory, tcId, tciIds, map, sessionId)",returning = "o")
    public void afterRunAll(JoinPoint joinPoint, Object o, ResultHistory resultHistory, Integer tcId, List<Integer> tciIds,
        Map<String, Object> map, String sessionId) {

        System.out.println("AfterReturning ... o = " + o);
    }

}

  

posted @ 2019-12-06 16:16  margo  阅读(1187)  评论(0编辑  收藏  举报