title: create error controller that would preserve the functionality of default error controller
body: <p>I need to implement <code>error controller</code> that would behave certain way for only single case - when it tries to display <code>whitelabel error page</code>. In other cases it should behave like the regular <code>BasicErrorController</code> that Spring Boot uses.</p>
  
  <p>My current controller it seems taking over every request and even causes redirect when there is basic 401 error, despite having <code>restexceptionhandler</code>.</p>
  
  <pre><code>@Controller
  @RequestMapping("/error")
  public class ErrorPageController implements ErrorController {
      private static final String LOCALHOST_SERVER_NAME = "localhost";
      private static final Logger LOGGER = LoggerFactory.getLogger(ErrorPageController.class);
      private static final String REDIRECT_FORMAT = "redirect:%s://%s%s";
      private static final String LOCALHOST_REDIRECT_FORMAT = "redirect:%s://%s:%d%s";
  
      @Value("${server.error.page.internalErrorPage}")
      private String internalErrorPage;
  
      @GetMapping(produces = "text/html")
      public String handleGetError(HttpServletRequest request) {
          return handleError(request);
      }
  
      @PutMapping(produces = "text/html")
      public String handlePutError(HttpServletRequest request) {
          return handleError(request);
      }
  
      @PostMapping(produces = "text/html")
      public String handlePostError(HttpServletRequest request) {
          return handleError(request);
      }
  
      @DeleteMapping(produces = "text/html")
      public String handleDeleteError(HttpServletRequest request) {
          return handleError(request);
      }
  
      private String handleError(HttpServletRequest request) {
          String redirectUrl;
          if (LOCALHOST_SERVER_NAME.equals(request.getServerName())) {
              redirectUrl = String.format(LOCALHOST_REDIRECT_FORMAT, request.getScheme(), request.getServerName(),
                  request.getServerPort(), internalErrorPage);
          } else {
              redirectUrl = String.format(REDIRECT_FORMAT, request.getScheme(), request.getServerName(),
                  internalErrorPage);
          }
  
          return redirectUrl;
      }
  
      @Override
      public String getErrorPath() {
          return "/error";
      }
  }
  </code></pre>
  
  <p>However, when I try to extend the <code>BasicErrorController</code> and it forces me to define a constructor</p>
  
  <pre><code>public ErrorPageController(ErrorAttributes errorAttributes, ErrorProperties errorProperties) {
      super(errorAttributes, errorProperties);
  }
  </code></pre>
  
  <p>it seems It cannot instantiate bean with error properties.</p>
  
  <pre><code>Parameter 1 of constructor in com.xxx.handler.ErrorPageController required a bean of type 'org.springframework.boot.autoconfigure.web.ErrorProperties'
  </code></pre>
  
  <p>What is the problem? What I want is just redirect when request failed and it came from <code>/api/oauth</code> URL, leaving other working as is.</p>