spring AOP注解方式下不进切面方法

发布于 2022-09-06 03:28:31 字数 1087 浏览 35 评论 0

最近写spring aop切面的时候,在一些方法上加了切点,然后在切面中添加对应切点的方法,但是有些切点的方法不执行,有的执行。下面是两个不进入的切点方法,希望大神帮忙看下问题出在哪!

/*测试切面start*/
    @Pointcut("execution(* com.ksource.esp.service.casehandle.PointCaseServiceImpl.getList (..))")
    public void pointCaseList(){};
    @Pointcut("execution(* com.ksource.esp.web.casehandle.InspectionDocumentController.indexDetail (..))")
    public void statisPointCase(){};
    
    @AfterReturning("pointCaseList()")
    public void afterList(JoinPoint joinPoint)throws ClassNotFoundException, SecurityException, NoSuchMethodException,
            IllegalArgumentException, IllegalAccessException,
            InvocationTargetException {
        System.out.println("案由列表后"+joinPoint.getArgs().toString());
    }
    @Before("statisPointCase()")
    public void afterStatis(JoinPoint joinPoint)throws ClassNotFoundException, SecurityException, NoSuchMethodException,
            IllegalArgumentException, IllegalAccessException,
            InvocationTargetException {
        System.out.println("统计案由后:"+joinPoint.getArgs().toString());
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤千羽 2022-09-13 03:28:31

getList (..)),中间没有空格,应该getList(..)),这个indexDetail (..))也是。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文