- Simple spring-boot-application with Postgresql with multi-tenancy
CloudConfiguration
: Provides the application instance information from the cloud.MultiTenantConnectionProviderImpl
: binds thedatasource
instance to the particulartenantId
provided byTenantProvider
.MultitenantHibernateJpaAutoConfiguration
: Main class which initialises/configures the hibernate JPA for crud operation.- How:
customizeVendorProperties
method configures the hibernate JPA for crud operation by taking correct tenantId fromTenantIdentifierResolverImpl
anddatasource pointing to particular tenantId
fromMultiTenantConnectionProviderImpl
.
- How:
TenantIdentifierResolverImpl
: Provides the tenantIdTenantProvider
: Simple class file to get tenantId from Security-context.