Spring Boot 自定义 Whitelabel Error Page

代码不起作用,因为当没有指定ErrorController的实现时,SpringBoot会自动将 BasicErrorController 注册为Spring Bean

修改Controller,作为 ErrorController的实现

@RestController
public class IndexController implements ErrorController{

    private static final String PATH = "/error";
	private static final String PATH = "/error";

    @RequestMapping(value = PATH)
    public String error() {
        return "Error handling";
    }
}