Class SystemPropertyTenantResolver
java.lang.Object
io.micronaut.multitenancy.tenantresolver.SystemPropertyTenantResolver
- All Implemented Interfaces:
TenantResolver
@Singleton
@Requires(beans=SystemPropertyTenantResolverConfiguration.class) @Requires(property="micronaut.multitenancy.tenantresolver.systemproperty.enabled",value="true",defaultValue="false")
public class SystemPropertyTenantResolver
extends Object
implements TenantResolver
A
TenantResolver
that resolves from a System property called "tenantId". Useful for testing.- Since:
- 1.0
- Author:
- Sergio del Amo
-
Field Summary
Fields inherited from interface io.micronaut.multitenancy.tenantresolver.TenantResolver
ALL, DEFAULT, PREFIX
-
Constructor Summary
ConstructorDescriptionSystemPropertyTenantResolver
(SystemPropertyTenantResolverConfiguration systemPropertyTenantResolverConfiguration) Constructs a system property tenant resolver. -
Method Summary
-
Constructor Details
-
SystemPropertyTenantResolver
public SystemPropertyTenantResolver(SystemPropertyTenantResolverConfiguration systemPropertyTenantResolverConfiguration) Constructs a system property tenant resolver.- Parameters:
systemPropertyTenantResolverConfiguration
-SystemPropertyTenantResolverConfiguration
Configuration for system property tenant resolver.
-
-
Method Details
-
resolveTenantIdentifier
Description copied from interface:TenantResolver
Resolves the current tenant identifier.
In a Multi Tenant setup where a single database is being used amongst multiple tenants this would be the object that is used as the tenantId property for each domain class.
- Specified by:
resolveTenantIdentifier
in interfaceTenantResolver
- Returns:
- the tenant ID if resolved.
- Throws:
TenantNotFoundException
- if tenant not found.
-