Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query on spring abstractroutingdatasource advantage #40

Closed
technok opened this issue May 12, 2020 · 2 comments
Closed

Query on spring abstractroutingdatasource advantage #40

technok opened this issue May 12, 2020 · 2 comments

Comments

@technok
Copy link

technok commented May 12, 2020

I am trying to understand more on the abstractRouting that spring offers.

  1. Wouldn’t a hashmap suffice the purpose of the lookup. I am trying to understand what advantage does the thread bound context brings in abstract routing ?
  2. What advantages does the AbstractRoutingDatasource brings in specific, since the same could be achieved using a simple if-else logic to determine the target from the hashmap?
@bytefish
Copy link
Owner

Surely it is not the only way to achieve multitenancy in an application, it's just that it is nicely integrated to Spring Boot and requires minimal plumbing to integrate it.

What would your implementation with HashMap look like?

@bytefish
Copy link
Owner

I don't know what's being asked exactely. I am sure there are alternative approaches. But the AbstractRoutingDataSource is probably the easiest way when using the Spring Framework and it integrates well into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants