private void makeAsyncRequests() {
    ListenableFuture<ResponseEntity<String>> listenableFuture =
        restTemplate.exchange(
            BASE_URL + "response-body", HttpMethod.GET, HttpEntity.EMPTY, String.class);
    listenableFuture.addCallback(
        new ListenableFutureCallback<ResponseEntity>() {
          @Override
          public void onSuccess(ResponseEntity result) {
            System.out.println("Response received (async callable): " + result.getBody());
          }

          @Override
          public void onFailure(Throwable t) {
            System.out.println("Response failed " + t.getMessage());
          }
        });
  }
 /** Make an HTTP request with custom headers */
 protected <T, U> ListenableFuture<ResponseEntity<T>> request(
     HttpMethod method, String uri, HttpHeaders httpHeaders, U body, Class<T> responseType) {
   HttpEntity<U> requestEntity = new HttpEntity<>(body, httpHeaders);
   return asyncRestTemplate.exchange(uri, method, requestEntity, responseType);
 }