Page 1 of 1

Add annotation failure

Posted: Mon Aug 20, 2012 8:37 am
by math7189
Hi,

I'm trying to add another annotation on the CatalogServiceImpl class. I'd like to add the RPCService annotation but when I run it the getAnnotation method on the bean doesn't work. It seems that there is an error while creating the bean.

I'm wondering if I missed something or if I did it in the wrong way. Do I need to extend this implementation and specify the new one? Cuz I just need this annotation, I don't need to override the methods.

Thanks

Re: Add annotation failure

Posted: Wed Aug 22, 2012 9:27 am
by math7189
Any idea to solve my problem? It's really weird that I can't add this annotation. I tried different ways but none of them worked.

When I create my own services with this annotation it works perfectly.

Re: Add annotation failure

Posted: Wed Aug 22, 2012 10:57 am
by phillipuniverse
Yes, I believe you will have to extend CatalogServiceImpl and then override the bean in XML. Docs for this are http://docs.broadleafcommerce.org/current/Extending-Services-Tutorial.html. In your specific case, your XML will look like:

Code: Select all

<bean id="blCatalogService" class="com.yourcompany.core.catalog.service.CustomCatalogServiceImpl" />


Then you should be able to add any annotation you want.

Re: Add annotation failure

Posted: Thu Aug 23, 2012 9:56 am
by math7189
This is exactly what I've done but didn't work. For the moment, I use another technic to do the same, I renamed my class in a specific way then I check if the name of the classes I scan contain this keyword.

This way is working but it's not really clean, I'll try later to add the annotation.