springboot 定制错误页面
项目中经常遇到的异常情况
- 400-Bad Request
-
401-Unauthorized
If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials.
-
403-Forbidden
The server understood the request, but is refusing to fulfill it.
- 404-Resource not found
-
500-Internal Server Error
定制错误页面的方法
- 在src/main/resource/templates/error/目录中增加
- 在src/main/resource/public/error/目录中增加
其中第一种方式的优先级大于第二种。