【问题标题】:@Around advice not work spring aspectj@Around 建议在春季方面不起作用
【发布时间】:2013-01-22 20:43:58
【问题描述】:

我是 aop 编程的新手,我对 @Around 建议有很大的疑问。 我有一个 Maven 项目 - aspectjrt 和 aspectjweaver 1.7.1 - 春天 3.2.0

根据官方指南 (http://static.springsource.org/srin.../html/aop.html),我已插入到我的 applicationContext 和示例方面

如果我使用指定的@Pointcut 尝试@AfterReturning @Before @After @AfterTrowing 一切正常,但如果我使用@Around 建议不起作用。

这是切入点,它围绕着建议

@Pointcut("execution(*PersonDbService.findPersonDiplomatici(..))")
private void dbFindOperationNoArgs() {}

@Around("dbFindOperationNoArgs()")
    public Object aroundAdv(ProceedingJoinPoint joinPoint) throws Throwable {
              // start stopwatch
          Object retVal = joinPoint.proceed();
          // stop stopwatch
          return retVal;
    }

这对我来说很奇怪,因为所有其他建议注释都有效

【问题讨论】:

    标签: spring aspectj


    【解决方案1】:

    尝试“调用”而不是“执行”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多