12

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.

asked Nov 21, 2013 at 17:42
0

3 Answers 3

22

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...

alain.janinm
20.1k11 gold badges67 silver badges114 bronze badges
answered Nov 25, 2013 at 17:12
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the answer @Shreshtt. It makes sense. Do you know in what situation this scope can be useful?
It is useful when you want to host your online shops for several individual customers on one hybris Multichannel Suite. In Multi-tenancy, each customer is called a tenant. According to their requirement they can customize your shops.
where does core-sprisearhng.xml is located ? I search all my hybris 5.7 installation and didn't find it
5

Hybris has 2 tenants by default- master tenant and junit tenant. You can create more tenants as required. Each tenant has its own set of data...say item types.

When a bean is defined in a tenant scope, it means that, that bean would be instantiated once for each tenant. And the same bean object would be used throughout the tenant.

answered Jul 10, 2014 at 11:41

Comments

4

hybris can be run in a Multi-Tenant mode which multiple individual sets of data are maintained on one single hybris installation.

When a bean is defined with a tenant scope, it will only be instantiated individually for each tenant; whereas singleton would create only one instance for all tenants to use.

answered Nov 23, 2013 at 4:34

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.