title: Multi-tenant Service using Spring webflux
body: <p>I am trying to implement multi-tenant service using Spring web flux.I have read examples of using AbstractRoutingDataSource and ThreadLocal TenantContext to populate the tenantId for mapping datasource cofigurations. However with Web Flux we cannot use ThreadLocal and therefore this solution.
  With WebFlux, I can read the tenant configuration which is a part of my User Principle - </p>
  
  <pre><code>ReactiveSecurityContextHolder.getContext().map(SecurityContext::getAuthentication)
              .map(Authentication::getPrincipal).cast(UserPrincipal.class).flatMap(user -&gt; {
                  TenantContext.setCurrentTenant(user.getTenantID().toString())
  </code></pre>
  
  <p>However I am not sure how to <strong>not</strong> use ThreadLocal. Can I use SubscriberContext for performing the same action?
  Any example or help would be much apprecited.</p>
  
  <p>Thanks</p>