解决shiro注释 超越权限问题

来源:互联网 发布:淘宝虚拟物品退款诈骗 编辑:程序博客网 时间:2024/06/08 11:12

用注释不会回到跳到超越权限的页面,因此要捕捉

可以用

@ExceptionHandler({Exception.class})


@ExceptionHandler({Exception.class})@ResponseStatus(HttpStatus.UNAUTHORIZED)public String processUnauthenticatedException(NativeWebRequest request, UnauthorizedException ex) {    // 为了区分,跳转掉另一个视图    return "noAuthorized";}

这里的HttpStatus没有导入

这样引入

import org.springframework.http.HttpStatus;

这个是

http://blog.csdn.net/frankcheng5143/article/details/50890118 知道的