Java 从aspectJ中带注释的方法获取局部变量值

Java 从aspectJ中带注释的方法获取局部变量值,java,methods,aop,aspectj,local-variables,Java,Methods,Aop,Aspectj,Local Variables,我正在使用aspectJ的java自定义注释 自定义注释 @Documented @Target(ElementType.METHOD) @Inherited @Retention(RetentionPolicy.RUNTIME) public @interface TrxLogger { String author() default "Shahid Ghafoor"; String comments() default "I am Fan of JAVA"; } 服务 public cl

我正在使用aspectJ的java自定义注释

自定义注释

@Documented
@Target(ElementType.METHOD)
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface TrxLogger {

String author() default "Shahid Ghafoor";
String comments() default "I am Fan of JAVA";
}
服务

public class Service {

private String name;

public String getName() {
    return name;
}


public void setName(String name) {
    this.name = name;
}

@TrxLogger
public String sayHello(String fn, String ln) {

    this.name=fn;

     String localVariable="Before System.out.println";

    System.out.println("Welcome!" + fn + " " + ln);

    return "The Transaction return Value";
}

}
方面

@Around(value="pcSample(tl)", argNames="tl")
public Object runMethod(ProceedingJoinPoint pjp, TrxLogger tl) throws Throwable {

 return null;
}

当sayHello方法执行时,是否可能在aspect中获取sayHello()方法的局部变量值(
String localVariable=“Before System.out.println”
)?

只有lovalVariable有值。否则任何人都不知道。不,局部变量就是局部变量。您无法深入研究该方法以访问它。无法通过反射访问方法体。

我们能否在pjp.procedure()之后找到它?