0

I have a url mapping for /error to go to my errorPage.html, but it is not redirecting to this, and I get the normal default spring boot error screen.

package coffee.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("/index.html");
        registry.addRedirectViewController("/admin", "admin/adminIndex.html");
        registry.addViewController("/error").setViewName("/errorPage.html");
    }

}

when I go to the url /error in the browser I get a status 999. when I go to an nonexistent address I get the default spring boot error page with a 404

Pbb
  • 408
  • 6
  • 21

1 Answers1

0

ended up writing a explicit controller implement ErrorController

Pbb
  • 408
  • 6
  • 21