on ‎2020 Jan 15 11:07 AM
Hi all.
I have to create two aspects/arounds in order to intercept two different methods of two different classes.
Now, I already created an aspect class that intercepts an OOB method correctly.
Here is what I did:
I created the aop.xml like this:
<aspectj>
<weaver options="-Xset:weaveJavaxPackages=true">
<include within="de.hybris.platform.cronjob.jalo.CronJob"/>
<include within="com.example.aspects.*"/>
</weaver>
<aspects>
<aspect name="com.example.aspects.ExampleCronJobEmailAspect"/>
</aspects>
</aspectj>
and an aspect java class:
@Aspect
public class ExampleCronJobAspect
{
@Around("execution(* de.hybris.platform.cronjob.jalo.CronJob.getRendererNotificationContext(..))")
public CronJobNotificationTemplateContext getRendererNotificationContext(
final ProceedingJoinPoint joinPoint) throws Throwable {
//myLogic
}
}
And it works fine.
So I just want to know if it is possibile to use the same xml and the same java class to intercept another method of an other class. How can I do it? How have I to edit my apo.xml to reach this goal?
Thank in advance.
Stochino
Request clarification before answering.
The following should work for you:
@Around("execution(* de.hybris.platform.cronjob.jalo.CronJob.getRendererNotificationContext(..)) || execution(* some-other-class-method(..))")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.