title: How pass context in multithreading threading
body: <p>We use multithreading and need the context of the calling thread in each sub-thread. We're using Spring 4.3.</p>
  
  <p>For example:</p>
  
  <pre><code>final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
  
  CompletableFuture.supplyAsync(() -&gt; {
      ...
      try {
          // take the security context from the caller
          SecurityContextHolder.getContext().setAuthentication(authentication);
          doOperations()
  </code></pre>
  
  <p>This approach works fine for the Security context. It's passed from the caller thread (rest endpoint) and passes it to each created completable future.</p>
  
  <p>At a given Class in the call chain, I've following construct:</p>
  
  <pre><code>@Context
  protected ProvisioningContext provisioningContext;  
  @Context
  protected UriInfo uriInfo;
  </code></pre>
  
  <p>How do I pass all contexts correctly in the newly created thread?</p>
  
  <p>Approaches like <code>ThreadContext.getContext()</code> are not working. </p>