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 java.lang.Object implements TenantResolver
ATenantResolverthat resolves from a System property called "tenantId". Useful for testing.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.multitenancy.tenantresolver.TenantResolver
ALL, DEFAULT, PREFIX
-
-
Constructor Summary
Constructors Constructor Description SystemPropertyTenantResolver(SystemPropertyTenantResolverConfiguration systemPropertyTenantResolverConfiguration)Constructs a system property tenant resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.SerializableresolveTenantIdentifier()Resolves the current tenant identifier.
-
-
-
Constructor Detail
-
SystemPropertyTenantResolver
public SystemPropertyTenantResolver(SystemPropertyTenantResolverConfiguration systemPropertyTenantResolverConfiguration)
Constructs a system property tenant resolver.- Parameters:
systemPropertyTenantResolverConfiguration-SystemPropertyTenantResolverConfigurationConfiguration for system property tenant resolver.
-
-
Method Detail
-
resolveTenantIdentifier
@NonNull public java.io.Serializable resolveTenantIdentifier() throws TenantNotFoundExceptionDescription copied from interface:TenantResolverResolves 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:
resolveTenantIdentifierin interfaceTenantResolver- Returns:
- the tenant ID if resolved.
- Throws:
TenantNotFoundException- if tenant not found.
-
-