How it works · Multi-tenancy
Resolve the tenant once; everything else routes on it
One deployment serves many customers. The tenant is checked against the caller's token and put in the request context, and from there configuration, behaviour, writes, reads and background work each route themselves. Business code never mentions the tenant.
tenant
request
view
Step 1
Exchange
Payload
The header must match the token
The tenant header picks the identity realm whose keys verify the token, so a user cannot claim another tenant by changing a header.
Database per tenant, no routing code
One DataSource routes every connection to the tenant's pool, and queries have their own tenant routing. An unknown tenant fails instead of landing in someone else's database.
Bespoke without branches
A tenant's configuration is a layer over the defaults, and a tenant's behaviour is a bean with its prefix. No if statements on the tenant.