title: How to accept text/csv as content-type in spring-web servlet?
body: <p>I want to create a simple webservice that produces <code>text/csv</code> content. But I cannot request it:</p>
  
  <pre><code>@RestController
  public class MyServlet {
      @PostMapping(produces = {"text/csv", "application/json"})
      public Object post() {
          //...
      }
  }
  
  spring.mvc.contentnegotiation.media-types.csv=text/csv
  </code></pre>
  
  <p>When I send a post request with <code>Content-Type: text/csv</code> as http header, I'm getting the following error:</p>
  
  <p>415: <code>Content type 'text/csv' not supported</code></p>
  
  <p>This is my configuration:</p>
  
  <pre><code>@Configuration
  public class ContentNegotiationConfiguration implements WebMvcConfigurer {
      @Override
      public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
          configurer
                  .favorParameter(true) //favor &amp;format=csv
                  .defaultContentType(MediaType.APPLICATION_JSON)
                  .parameterName(format);
                  //.mediaType("csv", new MediaType("text", "csv")) //also tried without success
      }
  }
  </code></pre>