title: In springboot application how to set default header if not present
body: <p>I have written a method with get request mapping it gives list of users. As jakson binding dependency is there is gives response in JSON. I've also dependency for XML which is Jackson Dataformat XML.So, if Accept is application/json it returns the response in JSON and if it is in application/xml it returns in XML.But by default it gives JSON response. SO, I wanted to add <strong>Accept</strong> header if not present and make it's default value as application/xml.</p>
  
  <pre><code>@GetMapping(path="/getAll")
      public List&lt;User&gt; getUsers(@RequestHeader(value= "Accept" ,required=false, defaultValue="application/xml") String Accept)
      {
          return service.findAll();
      }
  </code></pre>
  
  <p>But in above case, the header is not setting.</p>