title: Spring RestController returning error as html instead of json
body: <p>I have a spring boot webapp in which I have defined REST APIs. I am using spring security for REST API security.</p>
  
  <p>I have annotated my controller classes with RestController. 
  I recently updated spring boot, mvc and security to the latest version. </p>
  
  <p>I am now seeing that in my negative cases, before the update it was returning json error response, but now after the update, it is returning html error response.</p>
  
  <p>Before the update, it was giving following error response-</p>
  
  <pre><code>{
    "timestamp": "2018-05-21T18:22:37.105+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "Error message.",
    "path": "&lt;API path&gt;"
  }
  </code></pre>
  
  <p>After the update, it is giving following response.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Apache Tomcat/8.0.51 - Error report&lt;/title&gt;
          &lt;style type="text/css"&gt;H1 {font-family:Tahoma,Arial,sansserif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}&lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;HTTP Status 500 - Error message.&lt;/h1&gt;
          &lt;div class="line"&gt;&lt;/div&gt;
          &lt;p&gt;
              &lt;b&gt;type&lt;/b&gt; Status report
          &lt;/p&gt;
          &lt;p&gt;
              &lt;b&gt;message&lt;/b&gt;
              &lt;u&gt;Error message.&lt;/u&gt;
          &lt;/p&gt;
          &lt;p&gt;
              &lt;b&gt;description&lt;/b&gt;
              &lt;u&gt;The server encountered an internal error that prevented it from fulfilling this request.&lt;/u&gt;
          &lt;/p&gt;
          &lt;hr class="line"&gt;
          &lt;h3&gt;Apache Tomcat/8.0.51&lt;/h3&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I did not had any ExceptionHandler in my Controller. It was coming as json error by default. I have jackson and jackson-mapper-asl in my libs.</p>
  
  <p>I could not figure out if there is a default setting somewhere that needs to be changed to send errors as json.</p>
  
  <p>I also tried to disable ErrorPageFilter but even after that I am getting HTML response.</p>
  
  <p>Is there any way by which I can get json response rather than html?</p>