springboot2.0错误处理机制定制客户端错误页面

1.自定义异常类 2.编写controller,模拟抛出异常(当访问的user等于admin时,抛出异常信息) 3.在模板引擎文件夹下创建error文件夹,并在error文件夹下创建5XX.html, 在5xx.html中定义错误消息。Springboot2.0以后获取不到exception的 值,需要在全局配置文件中进行配置: `server.error.include-exception: t
相关文章
相关标签/搜索