只需要把错误页面放在resources/templates/error/下面,把文件名按照错误码命名就能自动找到页面
如:/resources/templates/error/404.html
需要一个视图解析框架:spring-boot-starter-thymeleaf 当然也可以是其他框架
--------------------------------springboot 错误页面源码逻辑-----------------------------


本文介绍如何在SpringBoot中配置自定义错误页面,通过将错误页面放置于特定目录下并按错误码命名,即可实现自动错误页面显示。推荐使用Thymeleaf或其他视图解析框架。
只需要把错误页面放在resources/templates/error/下面,把文件名按照错误码命名就能自动找到页面
如:/resources/templates/error/404.html
需要一个视图解析框架:spring-boot-starter-thymeleaf 当然也可以是其他框架
--------------------------------springboot 错误页面源码逻辑-----------------------------


1万+
6998

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