springboot使用

配置统一的错误页面

  1. 默认读取静态资源/static/error/500.html页面

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # applicaiton.yml
    server:
    error:
    path: /error # 默认读取该目前下的404/500页面
    include-stacktrace: always # 堆栈信息
    include-exception: true # 异常信息
    ```

    内置的异常信息类`org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController`
    1
    2

    2.

“timestamp” -> {Date@10456} “Mon Dec 21 14:14:12 CST 2020”
“status” -> {Integer@10457} 404
“error” -> “Not Found”
“message” -> “No message available”
“path” -> “/test/findAll”
```