What is tenant scope in Hybris?

Nirmal Mangal picture Nirmal Mangal · Nov 21, 2013 · Viewed 17.6k times · Source

I am very new to hybris e-commerce software and trying to learn with the help of wiki documents provided with it. I see use of 'tenant' scope quite frequently. I know about other scopes like 'singleton', 'prototype' etc. But I am not very clear with the tenant scope. appreciate if someone have a good understanding about this scope, and explain in simple terms. Thanks.

Answer

Free-Minded picture Free-Minded · Nov 25, 2013

The core-spring.xml file of the core extension adds a special scope named tenant to the global ApplicationContext. The tenant scope makes sure that the bean is instantiated individually for each individual tenant of the hybris, whereas singleton would create only one instance for all tenants to use.

If you reference tenant-specific classes like services or DAOs inside your implementation, you have to use the tenant scope instead of the default Spring singleton scope. In case of doubt, use tenant instead of singleton.

<bean id="myExtension.myBean" class="de.hybris.platform.myExtension.myClass" scope="tenant" />

Since version 5.0 of hybris Commerce Suite, tenant scope is no longer in use.

Check this for more details...