title: Java + Spring Boot: I am trying to add CacheControl header to ResponseEntity
body: <p>I am not so good in Java + Spring, but I'd like to add <code>Cache-Control</code> header to my <code>ResponseEntity</code>. </p>
  
  <pre><code>@RequestMapping(value = "/data/{id}", method = GET")
  public ResponseEntity&lt;String&gt; getData(@PathVariable("id") String id) {
      try {
              ...
              HttpHeaders headers = new HttpHeaders();
              headers.setCacheControl("max-age=600");
  
              return new ResponseEntity&lt;String&gt;(body, headers, HttpStatus.OK);
          }
  }
  </code></pre>
  
  <p>I added two lines of code for <code>HttpHeaders</code> and now I get two <code>Cache-Control</code> headers in my response:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Server: Apache-Coyote/1.1
  X-Content-Type-Options: nosniff
  X-XSS-Protection: 1; mode=block
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Pragma: no-cache
  Expires: 0
  X-Frame-Options: DENY
  Strict-Transport-Security: max-age=31536000 ; includeSubDomains
  Cache-Control: max-age=600
  Content-Type: application/json;charset=UTF-8
  Content-Length: 18223
  Date: Wed, 29 Jun 2016 21:56:57 GMT
  </code></pre>
  
  <p>What did I do wrong? </p>