Spring Boot 自定义错误页面

最简单的方式是直接在 template-loader-path 指向目录下创建error.[suffix]页面,此时如果访问不存在的画面就会直接进入此画面。

spring:
  application:
    name: blog
  freemarker:
    cache: false
    charset: utf-8
    expose-request-attributes: true
    expose-session-attributes: true
    suffix: .ftl
    template-loader-path: classpath:/webapp/