当spring抛出异常时出现的页面的@ExceptionHandler(RuntimeException.class) 用法

当spring抛出异常时出现的页面的@ExceptionHandler(RuntimeException.class) 用法

主要用在Controller层

  @ExceptionHandler(RuntimeException.class) 
      public String ex() {
          //这个是当spring跑出异常时出现的页面
        return "redirect:/unauthorized.jsp";
      }

 

posted @ 2018-06-16 23:06  城南少年与猫  阅读(2057)  评论(0编辑  收藏  举报