Blueprint: Subdomain handling with Spring Boot and Spring Web MVC
This blueprint demonstrates how you can map subdomains to Spring MVC controllers in one application. The use-cases are:
- Having a multi-tenancy application with a custom subdomain for each tenant.
- Combining various microsites on different subdomains into the same Spring Boot application.
- Or both of it.
You should have already read my blog post at https://www.schakko.de/2020/06/04/handling-subdomains-in-multi-tenant-applications-with-spring-boot-web-mvc/ to understand what's this all about.
This blueprint does **not**
- include any exsamples how to integrate Spring Security
- include any exsamples how to use Spring's Reactive features
- include fancy caching algorithms
- deal with @RestController annotations
- fix your CORS problems
- handle each of the corner cases you might think of
- allow annotations on method level but only on class level
It implements the two custom annotations for controller classes:
- @SubdomainController which can handle multiple subdomains like
- @TenantController which expects to resolve the current request to a tenant provided by a repository.
I am also providing a TenantRepository and TenantContext implementation to show how you can deal with subdomains for tenants.
- You can re-use the architecture template in your own projects.
- You should only purchase if you need a working sample project for handling subdomains with Spring Boot / Spring Web MVC. There is no support included and the whole archive comes as-is.
- You should have read my blog post about this topic and understood what I wanted to achieve.
- There is no support or further documentation included.
If you need commercial/enterprise support, please get in contact with me.
You'll get a ZIP file containing an importable Maven project which demonstrates the described use-case