title: Spring 5 consume multiple MediaType
body: <p>I'm using Spring boot 1.5.8.RELEASE
  I have an endpoint and would like to consume multiple MediaType.
  In particular <code>application/x-www-form-urlencoded</code> and <code>application/json</code> type.
  At the moment I have the below code. It works for <code>application/x-www-form-urlencoded</code>, but doesn't work for <code>application/json</code>.</p>
  
  <pre><code>@RequestMapping(path = "/abc", method = RequestMethod.POST,
                      consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_FORM_URLENCODED_VALUE},
                      produces = MediaType.APPLICATION_JSON_VALUE)
      @ResponseStatus(value = HttpStatus.OK)
      public ResponseEntity&lt;MyResponse&gt; validate(@Valid @ModelAttribute MyDetails details) {
          return something();
      }
  </code></pre>
  
  <p>I tried to put a content negotiator in my configuration, but still doesn't work.</p>
  
  <pre><code>    @Override
  public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
              configurer.favorPathExtension(false)
                        .defaultContentType(MediaType.APPLICATION_JSON)
                        .mediaType("x-www-form-urlencoded", MediaType.APPLICATION_FORM_URLENCODED);
          }
  </code></pre>
  
  <p>How can I allow the endpoint to accept these 2 media types?</p>