0 formal unbound in pointcut(Spring AOP)

原写法:

@Before("@annotation(org.haha.web.annotation.BrowAuth)
public void beforeExec(HttpServletRequest request) {

    ......

}

会报以下错误:

0 formal unbound in pointcut

 

原因是应该用args指明参数,改成以下就可以了:

@Before("@annotation(org.haha.web.annotation.BrowAuth) && (args(request,..) || args(..,request))")
public void beforeExec(HttpServletRequest request) {

    ......

}

你可能感兴趣的:(spring,AOP)