Skip to content

Instantly share code, notes, and snippets.

@iundarigun
Created November 13, 2020 18:20
Show Gist options
  • Select an option

  • Save iundarigun/5e4f00612d02e8316086d075f130f247 to your computer and use it in GitHub Desktop.

Select an option

Save iundarigun/5e4f00612d02e8316086d075f130f247 to your computer and use it in GitHub Desktop.
TenantDataSource
class TenantDataSource : AbstractRoutingDataSource() {
companion object {
val ctx = ThreadLocal<String>()
fun setClient(client: String) {
ctx.set(client)
}
}
override fun determineCurrentLookupKey(): Any? {
return ctx.get()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment