posted 6 years ago
I've developed a conceptual proof of a Spring Boot application with support for multitenancy. In a nutshell, my project consists of some API services (defined with interfaces), each with different implementations, and more than a single JPA entity manager to work with.
Both actual service implementation and JPA Entity manager are selected based upon a tenant-id that it's sent via API request.
I have to confess that realizing a multitenant-aware spring boot project, in which non only EMs , but also services injection are dependent on a request token was a really tricky work, mainly because Spring boot doesn't support multitenancy easily out of the box.
Now, despite my self-satisfaction for being able to solve an architectural puzzle, I wonder if nowadays is still important to develop a multitenant architecture, or such approach isn't anything more than a vestigia of pre-container times. I mean, with spring it would be a lot easier to use profiles to separate tenant and deploy different instances with docker (for example). An hint that multitenancy should be avoid if not strictly necessary may be the very same fact that Spring doesn't support it 'natively'.
What do you think about ?