相关疑难解决方法(0)

error引用的类型不是注释类型:

我有以下看点

@Around("execution(public * (@DisabledForBlockedAccounts *).*(..))" + " && @annotation(denyForTeam)")
public Object translateExceptionsDenySelectedAccount(ProceedingJoinPoint pjp, Deny deny) throws Throwable
{
    Account account = (Account) pjp.getArgs()[0];
    Account selectedAccount = (Account) pjp.getArgs()[1];

    if (ArrayUtils.contains(deny.value(), account.getRole()))
    {

        if (account.getType().equals(Type.CHEF) && !selectedAccount.getType().equals(Type.CHEF))
        {
            throw new IllegalAccessException("");
        }
    }
    return pjp.proceed();
}
Run Code Online (Sandbox Code Playgroud)

和这个注释:

@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
public @interface DenyForTeam
{

Role[] value();

}
Run Code Online (Sandbox Code Playgroud)

我得到错误:错误引用的类型不是注释类型:denyForTeam

为什么DenyForTeam没有注释?它标有@interface

aop spring spring-aop

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

aop ×1

spring ×1

spring-aop ×1