Page 1 of 1

Extended service does not get invoked

Posted: Sun May 18, 2014 11:56 am
by saulius
Hi all, what is the correct way to extend broadleaf service, in my case CatalogService.

none of these works for me:
http://www.broadleafcommerce.com/docs/c ... g-services
http://www.broadleafcommerce.com/docs/c ... s-tutorial

I tried to do this in three ways:

1. I created MyCatalogServiceImpl file which extends CatalogServiceImpl and implements MyCatalogService;
And created bean like this:
<bean id="org.broadleafcommerce.core.catalog.service.CatalogService"
class="com.mycompany.core.catalog.service.MyCatalogServiceImpl"/>

2. I created MyCatalogServiceImpl file which extends CatalogServiceImpl and implements MyCatalogService;
And created bean like this:
<bean id="blCatalogService"
class="com.mycompany.core.catalog.service.MyCatalogServiceImpl"/>

3. I created MyCatalogServiceImpl file which extends CatalogServiceImpl and implements MyCatalogService;
And added annotation to MyCatalogServiceImpl:
@Service("blCatalogService")

None of these extensions works for me, original services got called every time.

What am I doing wrong here?

Re: Extended service does not get invoked

Posted: Mon May 19, 2014 10:55 am
by phillipuniverse
The second way (with an id of blCatalogService) is definitely how you have to do it. The first way will not work, we inject most of our resources by name. The 3rd one will also not work because you'll get a bean name collision from Spring.

Things to check:

- Which applicationContext.xml did you add this bean to?
- If you added the bean to core/src/main/resource/applicationContext.xml, did you do a full maven install to rebuild the core jar as well?

Re: Extended service does not get invoked

Posted: Mon May 19, 2014 1:49 pm
by saulius
Thanks a lot for a quick and helpful response. Today I tried 2nd way to enxtend service again and it works :D.
Probably yesturday I was too tired and skipped rebuiding. Thanks a lot.