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
  • 356
  • 4
  • 18
  • You can check this previous post https://stackoverflow.com/a/37398678/4373948 Then tell us if it's useful ! – TinyOS Dec 07 '18 at 01:21

1 Answers1

0

ended up writing a explicit controller implement ErrorController

Pbb
  • 356
  • 4
  • 18