最近在做全局异常处理,可以根据请求方式返回不同类型异常信息,json返回的完全无问题,结构碰到返回页面的死活都是永恒的错误页面
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
null
There was an unexpected error (type=null, status=null).
开始还是一脸懵逼,后来在父项目依赖管理上找到原因,指定了spring-boot-starter-thymeleaf 的版本和使用的SpringBoot 2.1.0.RELEASE 不支持。 建议 spring-boot-starter-thymeleaf和spring-boot-starter-web 默认不指定版本。
添加“parent”标签里的内容后,“spring-boot-starter-parent”会为开发者提供常用jar的版本管理,所以我们不需要指定版本,使用人家提供好的就可以了。当然,指定也是可以的,这会覆盖官方默认的版本,不推荐