将 Struts 操作类管理委托给 Spring 会导致 Findbugs 中的 MTIA 严重违规
当我使用“将 Struts 操作管理委托给 Spring”方法时,请参阅 http://www.ibm.com/developerworks/java/库/j-sr2.html#N101B7 功能方面一切正常,但 findbugs 报告出现破坏 Dodgy - Class 扩展了 Struts Action 类并使用实例变量:MTIA
我通过 spring 将 bean 依赖项注入到了 action 类中。
请帮助我并建议我一个更干净的方法来解决这个问题。
谢谢
When i use "Delegate Struts Action management to Spring" approach explained in
http://www.ibm.com/developerworks/java/library/j-sr2.html#N101B7
things work fine in terms of functionality but findbugs reports following voilation
Dodgy - Class extends Struts Action class and uses instance variables:MTIA
I have bean dependencies injected into action class through spring .
Please help me and suggest me a cleaner way to solve this problem.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这只是对findbugs的误解。 FindBugs 看到注入器 setter 方法并假设可以在正常的操作流程中调用这些方法。如果真是这样的话,那么行动就有问题了。然而,由于这些方法仅在启动时使用,所以这不是问题。如果这些警告困扰您,您可以从 FindBugs 中排除这些警告。
This is just an misunderstanding with findbugs. FindBugs sees the injector setter methods and assumes that these can be called during the normal flow of the action. If that were the case, then the action would be problematic. However since these methods are only used at startup, it's not an issue. You can exclude this warnings from FindBugs if they are bothering you.