title: Spring boot resttemplate get request found 401 unauthorized exception
body: <p>Following code snippet receives <strong>401 unauthorized</strong> exception :</p>
  
  <pre><code>String uri = "https://api/example.json?status=all";
  RestTemplate restTemplate = new RestTemplate();
  HttpHeaders headers = new HttpHeaders();
  headers.setContentType(MediaType.APPLICATION_JSON);
  HttpEntity entity = new HttpEntity(headers);
  ResponseEntity &lt;String&gt; results = restTemplate.exchange(uri, HttpMethod.GET, entity, String.class;
  </code></pre>