@ExceptionHandler(Throwable.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ModelAndView exception(final Throwable throwable, final Model model) {
logger.error("Exception during execution of SpringSecurity application", throwable);
StringBuffer sb = new StringBuffer();
sb.append("Exception during execution of Spring Security application! ");
sb.append((throwable != null && throwable.getMessage() != null ? throwable.getMessage() : "Unknown error"));
sb.append(", root cause: ").append((throwable != null && throwable.getCause() != null ? throwable.getCause() : "Unknown cause"));
model.addAttribute("error", sb.toString());
ModelAndView mav = new ModelAndView();
mav.addObject("error", sb.toString());
mav.setViewName("error");
return mav;
}
ErrorController.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:Spring-Security-Third-Edition
作者:
评论列表
文章目录