有模板的支持下: 在templates文件夹下 建立 error文件夹
error文件夹下
404.html
500.html

4xx.html (名字就叫4xx.html)
5xx.html 

就像这样:

SpringBoot中自定义错误页面

 

 

错误消息的定制:

  timestamp:时间戳

​    status:状态码

​    error:错误提示

​    exception:异常对象

​    message:异常消息

​   errors:JSR303数据校验的错误都在这里

  通过[[${status}]]获取这样获取!

 比如这样:

SpringBoot中自定义错误页面

 



SpringBoot如果出现上面的问题 会自动转到该页面!!

 

测试效果:

SpringBoot中自定义错误页面

SpringBoot中自定义错误页面

 

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2021-12-12
  • 2022-12-23
  • 2021-11-22
  • 2022-02-04
  • 2021-05-28
  • 2022-01-24
猜你喜欢
  • 2021-11-07
  • 2021-09-18
  • 2021-11-17
  • 2021-11-03
  • 2021-10-17
  • 2022-12-23
相关资源
相似解决方案