Java 如果建议没有方法,Intellij能否显示警告?

Java 如果建议没有方法,Intellij能否显示警告?,java,intellij-idea,spring-aop,Java,Intellij Idea,Spring Aop,在我的spring boot应用程序中,我使用@afterreturn to advice方法来发送一些异步通知 @AfterReturning(pointcut = "execution(* test.NotificationService.sendNotification(..)) && args(informees, dataList)") public void afterSendNotification(Inf

在我的spring boot应用程序中,我使用@afterreturn to advice方法来发送一些异步通知

        @AfterReturning(pointcut = 
             "execution(* test.NotificationService.sendNotification(..)) && args(informees, dataList)")
        public void afterSendNotification(Informees informees, List<Data> dataList) {  
            ...
        }
这是当前实施的一个示例:

        @AfterReturning(pointcut = 
             "execution(* test.NotificationService.sendNotification(..)) && args(informees, dataList)")
        public void afterSendNotification(Informees informees, List<Data> dataList) {  
            ...
        }
@返回后(切入点=
“执行(*test.NotificationService.sendNotification(..)&&args(informees,dataList)”)
public void afterendnotification(Informees Informees,List dataList){
...
}
在开发过程中,sendNotification方法的签名从sendNotification(informes informes,Data Data)更改为sendNotification(informes informes,List dataList)。问题是切入点不再建议该方法,也不会显示错误或警告。intellij中的排水沟图标只是告诉我“建议无方法”。因此,很难立即看出代码不再正常运行

        @AfterReturning(pointcut = 
             "execution(* test.NotificationService.sendNotification(..)) && args(informees, dataList)")
        public void afterSendNotification(Informees informees, List<Data> dataList) {  
            ...
        }
  • 有没有办法在intellij中获得一个概述,显示所有建议的方法
  • 如果建议没有办法,我能得到警告吗
  • 有没有更好的方法来编写切入点
  • 目前,我正在研究编写单元测试,以确保建议得到执行。这是路吗

  • 不幸的是,IntelliJ IDEA缺少这样的功能。它也不完全支持完整的AspectJ语法。这个如此出色的IDE有很多缺点,与其他IDE相比,它是我个人最喜欢的但是每当我想在AspectJ中做一些事情时,我都会切换到Eclipse,这在这方面要优越得多,可能是因为AspectJ实际上是一个Eclipse项目,并且在IDE方面维护得更好。这里有一个外部参照(交叉参照)视图,以及在从方面到应用程序代码的两个方向上使用poinctut的视图,反之亦然。请参阅以获取一些屏幕截图更新:最后一个显示编辑器中的可视指示器,以及与任何连接点不匹配的建议的问题视图。这就是你要的

            @AfterReturning(pointcut = 
                 "execution(* test.NotificationService.sendNotification(..)) && args(informees, dataList)")
            public void afterSendNotification(Informees informees, List<Data> dataList) {  
                ...
            }
    
    如果您使用一个使用AspectJ Maven插件的Maven项目,您将获得两个方面的最佳效果。这可以导入到IDEA和Eclipse中,因此您可以在大部分时间使用IDEA,但可以利用Eclipse中更好的方面支持来管理您的方面。很抱歉没有更好的消息告诉您,但是JetBrains在处理AspectJ相关的支持票证或功能请求方面速度非常慢,而且不愿意

            @AfterReturning(pointcut = 
                 "execution(* test.NotificationService.sendNotification(..)) && args(informees, dataList)")
            public void afterSendNotification(Informees informees, List<Data> dataList) {  
                ...
            }