spring(boot)中/error
2019-05-15 本文已影响0人
luckee
在spring(boot)web项目中,/error
这个URL是被保留了的,被用来表示404
错误页面,如果自己写了一个error页面,则所有404
错误就会给用户显示自己写的error页面,如果自己没写错误页面,会显示一个默认的错误页面,如下面所示

不管我们在自己写的controller里面,将
/error
映射到哪个方法,也不管方法返回什么(逻辑视图名或者json字符串),访问/error
都是显示错误页面