title: Spring 3.1 or Later @RequestMapping Consumes/Produces
body: <p>I have a question in regards to the consumes and produces part of the <code>@RequestMapping</code>.  I have an endpoint that I want to accept both JSON and XML and return JSON when JSON is passed in and return XML when XML is passed in.  Is there anything special that I have to do to make this work?</p>
  
  <p>Sample code is listed below.</p>
  
  <pre><code>@RequestMapping(value = "/something", method = PUT, 
                  consumes = {APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE}, 
                  produces = {APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE})
  public SomeObject updateSomeObject(SomeObject acct) {
      return doStuff(acct);
  }
  </code></pre>
  
  <p>Will this work the way I'm expecting or do I need two endpoints <code>updateSomeObjectXML</code> and <code>updateSomeObjectJson</code> to handle both cases?</p>
  
  <p>Thanks,
  Mike</p>