title: How to Configure Spring Oauth2 for Multi tenant
body: <p>I'm currently developing multi-tenant application using spring and using oauth. Every tenant will have different database. If my url is tenant1.xxx.com, then it will use tenant1 database, etc. </p>
  
  <p>My request already successfully routed using AbstractRoutingDataSource but not the authentication. So when I ask an access token, it still using the default datasource. I think my problem is in oauth2 configuration that set datasource like TokenStore, etc.</p>
  
  <pre><code>@Autowired
  private DataSource dataSource;
  
  @Bean
  public TokenStore tokenStore() {
      return new JdbcTokenStore(dataSource);
  }
  </code></pre>
  
  <p>Is there anyway that token store can choose datasource according to current tenant?</p>