@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Import(value=com.holonplatform.spring.internal.tenant.TenantScopeRegistrar.class) public @interface EnableTenantScope
TenantScope.SCOPE_NAME
.
A TenantResolver
bean must be available in context to use the tenant scope. The TenantResolver
bean
definition name can be configured using the tenantResolver()
attribute or the
TENANT_RESOLVER_PROPERTY_NAME
configuration property when more than one TenantResolver
type bean is
available in context.
The convenience ScopeTenant
annotation can be used to declare tenant scoped beans.
If the enableTenantScopeManager()
attribute is true
, a TenantScopeManager
bean is
registered and made available in Spring context to manage the tenant scoped beans lifecycle.
ScopeTenant
Modifier and Type | Fields and Description |
---|---|
static String |
TENANT_RESOLVER_PROPERTY_NAME
Property which can be used to configure the
TenantResolver type bean definition name to be used to obtain
the current tenant id. |
Modifier and Type | Optional Element and Description |
---|---|
boolean |
enableTenantScopeManager
Whether to enable and register a
TenantScopeManager type bean definition, which can be obtained as any
other Spring bean, for example through dependency injection. |
String |
tenantResolver
Configures the name of the
TenantResolver type bean definition to be used to obtain the current tenant
id. |
public static final String TENANT_RESOLVER_PROPERTY_NAME
TenantResolver
type bean definition name to be used to obtain
the current tenant id. It has the same meaning of the tenantResolver()
attribute, but higher precedence.public abstract String tenantResolver
TenantResolver
type bean definition to be used to obtain the current tenant
id.
If not provided, the scope registrar will lookup for an unique TenantResolver
type bean definition in the
Spring application context. If not found, or more than one TenantResolver
type bean definition is found,
a scope configuration error is thrown.
TenantResolver
type bean definitionpublic abstract boolean enableTenantScopeManager
TenantScopeManager
type bean definition, which can be obtained as any
other Spring bean, for example through dependency injection.
The TenantScopeManager
API allows to manage the tenant scoped beans lifecycle, for example discarding
scoped bean instances for a specific tenant id, invoking any destruction callback accordingly.
The attribute value is true
by default.
TenantScopeManager
beanTenantScopeManager
Copyright © 2019 The Holon Platform. All rights reserved.