title: How to add client certificates to the Spring WebClient?
body: <p>I'm building a Spring WebClient which internally calls to REST API's which are hosted in different server. To do that I need to send public key (.cert) and private key (.key) to every request for the handshake.
  I'm not sure how to do that with Spring WebClient. </p>
  
  <p>I tried setting up WebClient, but struck at adding this peace of code</p>
  
  <p>WebClient Builder</p>
  
  <pre><code>this.webCLient = WebClient.builder()
                  .baseUrl("https://some-rest-api.com")
                  .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON.toString())
                  .build();
  </code></pre>
  
  <p>Actual Call</p>
  
  <pre><code>this.webClient.get()
                  .uri("/getData")
                  .exchange()
                  .flatMap(clientResponse -&gt; {
                      System.out.println(clientResponse);
                      return clientResponse.bodyToMono(MyClass.class);
                  });
  
  </code></pre>
  
  <p>Since there were no certificates added to the request, I'm getting the handshake error on the log</p>
  
  <pre><code>javax.net.ssl.SSLException: Received fatal alert: handshake_failure
  </code></pre>
  
  <p>How to add those certificates to the WebClient requests, so I don't get this error ? I have the certificates, but not sure how to add it.</p>