项目中经常遇到的异常情况
- 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/目录中增加
其中第一种方式的优先级大于第二种。
本文介绍了项目中常见的HTTP状态码,如400 BadRequest、401 Unauthorized、403 Forbidden等,并解释了它们的区别。同时,还提供了在Spring Boot项目中如何自定义错误页面的方法。
2237

被折叠的 条评论
为什么被折叠?



