AspectJ:回归后未到达

时间:2017-04-26 09:49:30

标签: java aop aspectj

我创造了这个方面:

@Pointcut("execution(* com.living.commty.boot.resources.*.* (..))")
public void resourcesCut() {}

我试图在他们返回后执行:

@AfterReturning(pointcut="resourcesCut()", returning="result")
public void afterReturning(JoinPoint joinPoint, Object result)
{
    this.logAfterReturningTrace(joinPoint, result);
}

我的课程是:

package com.living.commty.boot.resources;
public class EmailResources {

    @Inject private ConfigurationResources configurationResources;
    @Inject protected TokenResources cipheringResources;

    public String buildURI(String id, byte[] token) throws URISyntaxException
    {       
        return "";
    }

    public byte[] decodeParameter(String value)
    {
        return "";
    }

    public void sendActivationMail(User user) throws MailGenerationException
    {

    }
}

然而,它们永远不会到达。

然而,如果我添加@Before

@Before("resourcesCut()")
public void beforeCreate(JoinPoint joinPoint) {
    this.logBeforeTrace(joinPoint);
}

它到达了!

ECLIPSE

正如您可以看到这张图片:

  1. @AfterThrowing包含了很多方法,最多可达39个,或多或少。
  2. enter image description here

    1. 但是,@AfterReturning只包含6个方法执行......
    2. enter image description here

0 个答案:

没有答案