title: Right way to use Spring WebClient in multi-thread environment
body: <p>I have one question regarding <strong>Spring WebClient</strong></p>
  
  <p>In my application I need to do many similar API calls, sometimes I need change headers in the calls (Authentication token). So the question arises, what would be better of the two options: </p>
  
  <ol>
  <li><p><strong>To create one WebClient for all incoming requests to MyService.class, by making it <code>private final</code> field, like code below:</strong></p>
  
  <p><pre><code>private final WebClient webClient = WebClient.builder()
          .baseUrl("<a href="https://another_host.com/api/get_inf" rel="noreferrer">https://another_host.com/api/get_inf</a>")
          .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
          .defaultHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
          .build();
  </pre></code></p></li>
  </ol>
  
  <p>Here arises another question: is WebClient thread-safe? (because service is used by many threads)</p>
  
  <ol start="2">
  <li><strong>To create new WebClient for each new request incoming to service class.</strong></li>
  </ol>
  
  <hr>
  
  <p>I want to provide maximum performance, and to use it in right way, but I don't know how WebClient works inside it, and how it expects to be used.</p>
  
  <p>Thank you.</p>