I desperately need help on this. I’ve have been looking all over for a way to do this.
I am using Spring AOP in a web app running in Tomcat 7.
I am trying to use a @Before advice to print the names and values of the actual arguments of method pointcuts.
First I thought simply compiling the class files with the -g option will do the trick. That didn’t work.
Then I read in a post somewhere that using AspectJ load-time weaving will for sure do the trick. So I did the following for Tomcat 7:
In my context.xml
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
In my config.xml
<context:load-time-weaver weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
But still when I call MethodSignature.getParameterNames() it returns null.
So my question is:
Is there a way to get the parameter names of a method from within an advice? If so how?
Compiling with debug information is a requirement.
Then you can use an instance of
org.springframework.core.LocalVariableTableParameterNameDiscovererto resolve the parameter names.