GitPedia

Spring boot multitenant

Spring Boot Multi-tenant Sample

From rcandidosilva·Updated April 8, 2026·View on GitHub·

This is a Spring Boot multi-tenant sample using multiple datasources to persist data in different schemas. That is using the [Hibernate multi-tenancy support](https://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch16.html) working with the separate database strategy. The project is written primarily in Java, first published in 2016. Key topics include: spring-boot, tenant.

spring-boot-multitenant

This is a Spring Boot multi-tenant sample using multiple datasources to persist data in different schemas.
That is using the Hibernate multi-tenancy support working with the separate database strategy.

Compile and package

Being Maven centric, you can compile and package it without tests using:

mvn clean package -Dmaven.test.skip=true

Once you have your jar file, you can run it.

Run it

To run it you can go to the Maven target folder generated and execute the following command:

java -jar multitenant-XXX.jar

Testing

Once started you can go and request the data using different tenants :

  • curl -X GET http://localhost:8080/products
  • curl -X GET -H "tenant:secondDS" http://localhost:8080/products
  • curl -X GET -H "tenant:thirdDS" http://localhost:8080/products

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from rcandidosilva/spring-boot-multitenant via the GitHub API.Last fetched: 6/25/2026