on 2018 Oct 03 2:16 PM
Hello,
I want to send a email only in case cronjob failure,
So I am trying to overwrite public function sendEmail in CronJob.class to write my code but my new class is ignored
CronJob.class is in package de.hybris.platform.cronjob.jalo and I am using hybris 5.7
Thank you in advance.
Request clarification before answering.
You could try injection your custom implementation like this:
<bean id="de.hybris.platform.cronjob.jalo.CronJob" class="myPackage.jalo.CustomCronjob" scope="prototype" />
Source: Spring in the hybris Multichannel Suite - Prior to 4.3.0 (This still works, even for 1808!)
But be aware that the Cronjob class is the base class for various other, older platform jobs, and those will still use the old implementation.
If injecting the class doesn't work for your use case, try to intercept the Cronjob.sendEmail method using AOP.
Start first with Spring AOP, and if that doesn't work, use load-time weaving with AspectJ.
Both approaches are explained here: Spring AOP in SAP Hybris Commerce
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.