springboot 在 BasicErrorController 類裏實現了默認的錯誤處理。只需要將對應的錯誤提示文件放到 resources/static/error 目錄,支持模糊匹配,如:
static/error/4xx.html
static/error/5xx.html
static/error/404.html
static/error/error.html
運行項目,然後輸入不存在的地址,觸發 404 錯誤。
springboot 在 BasicErrorController 類裏實現了默認的錯誤處理。只需要將對應的錯誤提示文件放到 resources/static/error 目錄,支持模糊匹配,如:
static/error/4xx.html
static/error/5xx.html
static/error/404.html
static/error/error.html
運行項目,然後輸入不存在的地址,觸發 404 錯誤。