spring boot error handling

Posted 第二人生Bonnie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring boot error handling相关的知识,希望对你有一定的参考价值。

参考:https://docs.spring.io/spring-boot/docs/1.5.4.RELEASE/reference/htmlsingle/#boot-features-error-handling

 

spring boot 提供了默认的/error路径,并展示一个全局的错误页面。 以下几种方式用来自定义错误处理:

(1)实现 ErrorController 接口或者继承BasicErrorController类

(2)实现ErrorAttributes 接口或者继承DefaultErrorAttributes类

(3)使用@ControllerAdvice注解

 

以上是关于spring boot error handling的主要内容,如果未能解决你的问题,请参考以下文章