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

Feature Request: spring-boot-multitenancy-starter #28812

Closed
nightswimmings opened this issue Nov 25, 2021 · 4 comments
Closed

Feature Request: spring-boot-multitenancy-starter #28812

nightswimmings opened this issue Nov 25, 2021 · 4 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@nightswimmings
Copy link

nightswimmings commented Nov 25, 2021

I think this is the starter I miss the most in this near perfect framework. It should be an autconfiguration for multitenant setups, which nicely integrates with spring-data (for datasource resolution), spring-oauth2-resource-server (since tenantId could come from a token jwt claim), and spring-logging (for contextualization of tenant as an MDC property). I guess a custom centralized service would still be needed to store all tenant informations, but it still would speed up a lot this typical need

Just a proposal :)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 25, 2021
@wilkinsona
Copy link
Member

wilkinsona commented Nov 25, 2021

Thanks for the suggestion, but I don't think that multi-tenancy is something that Spring Boot can have a strong enough opinion about to warrant having an auto-configuration and a starter for it. For example, there's no guarantee that a multi-tenant application will be using a DataSource or that it will be using OAuth. I think there are just too many variables around each individual application's approach to multi-tenancy for Boot to do anything meaningful. Thanks again for the suggestion though.

@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 25, 2021
@nightswimmings
Copy link
Author

nightswimmings commented Nov 25, 2021

@wilkinsona Perhaps narrowing it down to a cool abstraction for datasource proxying in spring-data (jpa/mongo etc..) would be more resonable and maybe not callign it spring-boot-multitenancy but spring-boot-data-multitenancy?

@wilkinsona
Copy link
Member

If you haven't already seen them, you may want to look at Spring Framework's AbstractRoutingDataSource (JDBC) and AbstractRoutingConnectionFactory (R2DBC). I'm not aware of equivalents for the NoSQL data stores supported by Spring Data. You could raise that with the Data team on Gitter.

I still don't see any scope for Spring Boot auto-configuring anything at this point. We'd like to offer support for auto-configuring multiple DataSource beans and the like (#15732). That change may then given us something upon which we could build auto-configuration for AbstractRoutingDataSource and the like, but that would almost certainly need to be something that you opt into as not every application with multiple data sources will be a multi-tenant application.

@nightswimmings
Copy link
Author

Amazing thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants