I am creating an aspect class with spring aspectj as follows
@Aspect
public class AspectDemo {
@Pointcut("execution(* abc.execute(..))")
public void executeMethods() { }
@Around("executeMethods()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
System.out.println("Going to call the method.");
Object output = pjp.proceed();
System.out.println("Method execution completed.");
return output;
}
}
Now I want to access the property name of the abc class, and then how to get it in the aspect class? I want to show the abc class name property in the profile method
my abc class is as follows
public class abc{
String name;
public void setName(String n){
name=n;
}
public String getName(){
return name;
}
public void execute(){
System.out.println("i am executing");
}
}
How can I access the name in the class aspect?
source
share