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
Modifier and TypeMethodDescription@NonNull String
Resolves the current tenant identifier.@NonNull Serializable
Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
SystemPropertyTenantResolver
public SystemPropertyTenantResolver(SystemPropertyTenantResolverConfiguration systemPropertyTenantResolverConfiguration) Constructs a system property tenant resolver.- Parameters:
systemPropertyTenantResolverConfiguration
-SystemPropertyTenantResolverConfiguration
Configuration for system property tenant resolver.
-
-
Method Details
-
resolveTenantId
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:
resolveTenantId
in interfaceTenantResolver
- Returns:
- the tenant ID if resolved.
- Throws:
TenantNotFoundException
- if tenant not found.
-
resolveTenantIdentifier
@Deprecated(forRemoval=true, since="5.5.0") @NonNull public @NonNull Serializable resolveTenantIdentifier() throws TenantNotFoundExceptionDeprecated, for removal: This API element is subject to removal in a future version.UseresolveTenantId()
insteadDescription 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.
-
resolveTenantId()
instead