title: Howto use Spring Resttemplate with JSON only
body: <p>I have a rest-service which provides information in XML or JSON. I connect my application to this service with Spring Resttemplate. Unfortunately my responses are all in XML instead of the prefered JSON format. My analysis of the requests is, that Spring Resttemplate sends the request with the following Accept-Header:</p>
  
  <pre><code>Accept: application/xml, text/xml, application/*+xml, application/json
  </code></pre>
  
  <p>My rest-service response with the first accepted type. This is allways application/xml.</p>
  
  <p>How can I change the Accept-Types so that I only get json responses? Are there some properties for this in the bean-definition of RestTemplate?</p>
  
  <p>I use Spring 3.1 for this.</p>