Where does the default JSON errors response in spring-boot-starter-web comes from and how to adjust it?

余生长醉 提交于 2019-11-30 18:55:52

The output is created by Spring Boot's BasicErrorController. It's used as a fallback when your application hasn't handled an exception using Spring MVC (with an ExceptionHandler or ControllerAdvice, for example) or a container error page.

The JSON is created by an implementation of ErrorAttributes. By default, Spring Boot will use DefaultErrorAttributes. You can customise this by creating your own @Bean that implements ErrorAttributes.

See the error handling section of the Spring Boot documentation for more information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!