当在页面访问时出现类似404、500之类的错误,直接给用户返回报错页面是及其不友好的
如果集成了thymeleaf则可以在template下直接在error文件夹,创建对应错误代码的html页面
该页面也可以通过th语句获取错误信息
如果在static和templates中都创建了error文件夹,并对应了错误代码
则会优先选择准确的代码html
否则会选择templates中的
<body>
4xx错误
<p>[[${timestamp}]]</p>
<p>[[${status}]]</p>
<p>[[${message}]]</p>
<p>[[${exception}]]</p>
<p>[[${error}]]</p>
<p>[[${company}]]</p>
</body>