I'm working with Hybris 6.2, and I need to customize some of the resources that are generated from my items.
I've read this link, and this link, but I am unable to make my custom resource to be used.
My resource is located in myextension\custom\src\de\hybris\platform\yacceleratorcore\customresource as indicated in the mentioned wiki guide, and so far looks like this:
package de.hybris.platform.yacceleratorcore.customresource;
import de.hybris.platform.webservices.AbstractYResource;
import de.hybris.platform.yacceleratorcore.model.SparepartsModel;
import org.apache.log4j.Logger;
@SuppressWarnings("PMD")
public class CustomSparepartsResource extends AbstractYResource<SparepartsModel>
{
private static final Logger LOG = Logger.getLogger(CustomSparepartsResource.class);
public CustomSparepartsResource()
{
super("CustomSpareparts");
}
@Override
protected SparepartsModel readResource(final String resourceId) throws Exception
{
final SparepartsModel model = new SparepartsModel();
model.setCode(resourceId);
LOG.debug("Custom resource");
return (SparepartsModel) readResourceInternal(model);
}
}
I'm trying to just print that log message just as a start, but this resource is not being used instead of the default one that is generated on each ant clean all.
I have this resource bean defined in my web-spring.xml as follows:
<bean id="customSparepartsResource" class="de.hybris.platform.yacceleratorcore.customresource.CustomSparepartsResource" scope="prototype" parent="abstractResource"/>
But when I start the server, I get the following error message:
[1;31mERROR [localhost-startStop-1] [ContextLoader] Context initialization failed [m org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [de.hybris.platform.yacceleratorcore.customresource.CustomSparepartsResource] for bean with name 'customSparepartsResource' defined in class path resource [customplatformwebservices-web-spring.xml]; nested exception is java.lang.ClassNotFoundException: de.hybris.platform.yacceleratorcore.customresource.CustomSparepartsResource
What am I missing on my implementation? How can I successfully replace the generated resource with my own custom resource?