Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.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
Eclipse Spring@AspectJ@Pointcut匹配,而不管参数列表如何_Eclipse_Spring_Aop_Aspectj_Pointcut - Fatal编程技术网

Eclipse Spring@AspectJ@Pointcut匹配,而不管参数列表如何

Eclipse Spring@AspectJ@Pointcut匹配,而不管参数列表如何,eclipse,spring,aop,aspectj,pointcut,Eclipse,Spring,Aop,Aspectj,Pointcut,如何编写一个Spring@AspectJ切入点(@Pointcut)表达式来匹配类中的所有公共方法,而不管它们的参数列表如何 我想要一个方面,对于具有特定注释的特定类的所有公共方法,@MyAnnotation(类似于其他人想要的)。目前我的情况是这样的: @Aspect public final class ServiceDataAccessExceptionReporter { @Pointcut("execution(public * com.example.Service.*

如何编写一个Spring@AspectJ切入点(
@Pointcut
)表达式来匹配类中的所有公共方法,而不管它们的参数列表如何

我想要一个方面,对于具有特定注释的特定类的所有公共方法,
@MyAnnotation
(类似于其他人想要的)。目前我的情况是这样的:

 @Aspect
 public final class ServiceDataAccessExceptionReporter {

    @Pointcut("execution(public * com.example.Service.*(..)) && @annotation(com.example.MyAnnotation))")
    public void annotatedMethod() {}

    @AfterThrowing(pointcut = "annotatedMethod()", throwing = "exception")
    public void reportException(final DataAccessException exception) {
       ...
    }
 }
Eclipse Spring插件指出(在源代码窗口中使用箭头注释)这是正确的建议方法
com.example.Service.getNames()
。但它并不表示已经建议使用具有参数的方法,例如
com.example.Service.getTimes(字符串名)


这是因为带有
@Pointcut
注释的方法没有参数吗?如何使切入点成为所有方法,而不考虑它们的参数列表?或者我必须为我的
com.example.Service
类中的每种参数列表单独设置一个
@Pointcut

测试产生的WAR表明该方面实际上正在工作,并且我想要成为Pointcut的服务类的所有方法都是Pointcut

我的结论是,这实际上是Eclipse Spring插件中的一个缺陷:当
@Pointcut
匹配多个位置时,它不会显示所有连接点,而是只显示一个连接点,这是它任意选择的