Springboot - 错误页面重定向 - 根据错误码重定向到指定页面


  1. 在resources目录下建立文件夹public
  2. 在public目录下建立文件夹error
  3. 在error文件夹下放置404.html,500.html等各种错误页面
  4. 在resources下的templates文件夹下,创建error.html页面
error.html
http状态有很多,当遇到一个你没有定义的错误时,会跳转到error.html