title: SpringBoot Webflux cannot return application/xml
body: <p>In my reactive REST API I'm trying to return an <code>XML</code> response. However, I always get a <code>JSON</code>, namely <code>406 NOT_ACCEPTABLE</code>. Any idea why?</p>
  
  <pre><code>@RestController
  @RequestMapping(path = "/xml", produces = APPLICATION_XML_VALUE)
  public class RestApi {
      @GetMapping(path = "/get")
      public Publisher&lt;ResponseEntity&gt; get() {
          return Mono.just(ResponseEntity.ok().contentType(APPLICATION_XML).body(new Datta("test")));
      }
  
      @PostMapping(path = "/post", consumes = APPLICATION_XML_VALUE)
      public Publisher&lt;ResponseEntity&lt;Datta&gt;&gt; post(@RequestBody Datta datus) {
          datus.setTitle(datus.getTitle() + "!");
          return Mono.just(ResponseEntity.ok().contentType(APPLICATION_XML).body(datus));
      }
  }
  </code></pre>
  
  <blockquote>
    <p>java.lang.AssertionError: 
    Expected :application/xml
    Actual   :application/json;charset=UTF-8</p>
  </blockquote>
  
  <pre><code>plugins {
      id 'org.springframework.boot' version '2.1.3.RELEASE'
      id "io.spring.dependency-management" version "1.0.7.RELEASE"
  }
  dependencies {
      implementation 'org.springframework.boot:spring-boot-starter-webflux'
      implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8"
      testImplementation 'org.springframework.boot:spring-boot-starter-test'
  }
  </code></pre>
  
  <p>These are the links to my REST <a href="https://github.com/maslick/fluxish/blob/master/src/main/java/io/maslick/fluxish/RestApi.java" rel="nofollow noreferrer">controller</a> and a <a href="https://github.com/maslick/fluxish/blob/master/src/test/java/io/maslick/fluxish/FluxishApplicationTests.java" rel="nofollow noreferrer">unit test</a>. Thanks!</p>