【发布时间】:2012-04-26 13:54:57
【问题描述】:
我非常需要这方面的帮助。我一直在寻找一种方法来做到这一点。 我在 Tomcat 7 中运行的 Web 应用程序中使用 Spring AOP。 我正在尝试使用@Before 建议来打印方法切入点的实际参数的名称和值。 首先,我认为只需使用 -g 选项编译类文件就可以了。那没有用。 然后我在某处的帖子中读到使用 AspectJ 加载时编织肯定会成功。所以我为 Tomcat 7 做了以下操作:
在我的 context.xml 中
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
在我的 config.xml 中
<context:load-time-weaver weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
但是当我调用 MethodSignature.getParameterNames() 时,它仍然返回 null。
所以我的问题是: 有没有办法从建议中获取方法的参数名称?如果有怎么办?
【问题讨论】:
标签: java spring reflection aop