Spring Boot Remove Whitelabel Error Page

The Solution to Spring Boot Remove Whitelabel Error Page is

You need to change your code to the following:

public class IndexController implements ErrorController{

    private static final String PATH = "/error";

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

    public String getErrorPath() {
        return PATH;

Your code did not work, because Spring Boot automatically registers the BasicErrorController as a Spring Bean when you have not specified an implementation of ErrorController.

To see that fact just navigate to ErrorMvcAutoConfiguration.basicErrorController here.

~ Answered on 2014-08-18 11:59:08

Most Viewed Questions: