如何调试 ProxyFactoryBean 拦截器未触发
我正在尝试使用 MethodInterceptor 和 ProxyFactorBean 来生成特定方法的审核信息。
我可以看到 beanInterceptedOpMethod 已初始化,但在调用originalOp 时它永远不会被调用。我在日志中没有看到任何错误。
Spring 中是否有一些调试功能可以追踪它没有被调用的原因?
<bean id="interceptedOpMethod" class="com.chunk.audit.CollectData" />
<bean id="originalOp" class="com.chunk.calculate.Stats" />
<bean id="interceptedOp" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="originalOp" />
<property name="interceptorNames">
<list>
<value>interceptedOpMethod</value>
</list>
</property>
</bean>
I'm trying to use the MethodInterceptor and ProxyFactorBean to be able to produce audit information on a particular method.
I can see that the bean interceptedOpMethod is initialized, but it never gets called when originalOp is called. I don't see any errors in the log.
Is there some debugging capability within Spring to be able to track down why it isn't getting called?
<bean id="interceptedOpMethod" class="com.chunk.audit.CollectData" />
<bean id="originalOp" class="com.chunk.calculate.Stats" />
<bean id="interceptedOp" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="originalOp" />
<property name="interceptorNames">
<list>
<value>interceptedOpMethod</value>
</list>
</property>
</bean>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您如何实例化 com.chunk.calculate.Stats?如果你通过“new”创建它,那么Spring永远没有机会将切点注入到它的实例方法中。
How are you instantiating com.chunk.calculate.Stats? If you create it via "new", then Spring never has the chance to inject the cut points into its instance methods.