1

我正在使用 spring AOP 来检查权限

@Component
@Aspect
public class PermissionManager {
   @Around(value = "@annotation(requiredPermission) && args(id,..)", argNames = "id,requiredPermission")

public Object checkCanViewFile(ProceedingJoinPoint pjp, String id, RequiredPermission permission) throws Throwable {
  ...
}
}

控制器

@RequiredPermission(RequiredPermission.OperationType.editProject)
@RequestMapping("/searchFile")
public @ResponseBody
WebFile search(String id, String word) throws TokenExpiredException, FetchException    {

...
}

它适用于 spring mvc 测试,但不能在真实环境中运行。'id'的值为null,我怀疑spring AOP在jackson objectmapper之前得到这个方法,对吗?如何解决?

4

0 回答 0