title: Disable redirect to /error for certain urls
body: <p>I have created a springboot application that contains some Rest API endpoints in .../api/myEndpoints... and thymeleaf templates for some UI forms the user can interact with. </p>
  
  <p>Since I added an errorController:</p>
  
  <pre><code>@Controller
  @RequestMapping("/error")
  public class ErrorController {
  
      @RequestMapping(method = RequestMethod.GET)
      public String index(Model model) {
          return "error";
      }
  }
  </code></pre>
  
  <p>whenever an exception is being thrown in my RestControllers, I receive an empty white website containing the word "error". This maybe makes sense for the web frontend, but not for my api. For the API I want spring to output the standard JSON result e.g.:</p>
  
  <pre><code>{
      "timestamp": 1473148776095,
      "status": 400,
      "error": "Bad request",
      "exception": "java.lang.IllegalArgumentException",
      "message": "A required parameter is missing (IllegalArgumentException)",
      "path": "/api/greet"
  }
  </code></pre>
  
  <p>When I remove the index method from the ErrorController, then I always receive the JSON output. 
  My question is: Is it somehow possible to exclude the automatic redirection to /error for all api urls (../api/*) only?</p>
  
  <p>Thanks a lot. </p>