title: Spring Boot Application Error Handling Always Returns Content-Type of application/xml
body: <p>I have a Spring Boot REST service that has Spring Security enabled.  When I attempt to access an endpoint or resource that requires authentication in order to access, I get the following response:</p>
  <pre><code>&gt;&gt; GET https://mysite/secure-endpoint
  &gt;&gt; Content-Type: application/json
  &gt;&gt; ... (other request headers)
  
  &lt;&lt; HTTP 401 Unauthorized
  &lt;&lt; Content-Type: application/xml;charset=UTF-8
  &lt;&lt; ... (other response headers)
  &lt;&lt; Body:
  &lt;&lt; &lt;UnauthorizedException&gt;
  &lt;&lt;     &lt;error&gt;unauthorized&lt;/error&gt;
  &lt;&lt;     &lt;error_description&gt;Full authentication is required to access this resource&lt;/error_description&gt;
  &lt;&lt; &lt;/UnauthorizedException&gt;
  </code></pre>
  <p>Note that I have made this request with requested content-type of &quot;application/json&quot;.  Spring returns it with &quot;application/xml&quot;.  How do I configure Spring error handling to respect the <code>Content-Type</code> request header?</p>