i am creating an aspect class with spring aspectj as follow
@Aspect
public class AspectDemo {
@Pointcut(\"execution(* abc.execute(..))\")
public void
You need to get a reference to the target object and cast it to your class (after an instanceof check, perhaps):
Object target = pjp.getTarget();
if (target instanceof Abc) {
String name = ((Abc) target).getName();
// ...
}
The recommended approach (for performance and type safety) is to have the target mentioned in the pointcut:
@Around("executeMethods() && target(abc)")
public Object profile(ProceedingJoinPoint pjp, Abc abc) ....
But this will only match the executions on a target of type Abc.