billkoch / multi-tenant-jpa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi Tenant JPA Example

Quick Start

  1. Spin up MySQL
$ docker-compose up -d
  • Start Spring Boot Application
$ ./gradlew bootRun
  • Create a fresh database for the foo tenant
$ http POST :8080/admin/tenants/foo
  • Create a fresh database for the bar tenant
$ http POST :8080/admin/tenants/bar
  • Retrieve the list of people persisted in each tenant's database
$ http GET :8080/api/people X-TENANT-ID:foo
$ http GET :8080/api/people X-TENANT-ID:foo
  • Create different people in each tenant's database
$  http POST :8080/api/people firstName=Jane lastName=Doe X-TENANT-ID:foo
$  http POST :8080/api/people firstName=John lastName=Smith X-TENANT-ID:bar

About

License:Apache License 2.0


Languages

Language:Java 100.0%