Maven 与 Spring 注入
我是 Maven 新手。当我尝试构建具有弹簧注入的项目时,我收到以下错误:
Rule:InstanceVariableThreadSafety Priority:1 A class extending RequestHandler
or Action or SessionBean contains instance variables. It may not be Threadsafe.
The code should be reviewed and validated by the application team Tech Lead..
请帮助我解决此问题。
谢谢。
I am new to maven. When I try to build my project which has spring injection, im getting the following error:
Rule:InstanceVariableThreadSafety Priority:1 A class extending RequestHandler
or Action or SessionBean contains instance variables. It may not be Threadsafe.
The code should be reviewed and validated by the application team Tech Lead..
Please help me to resolve this.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该规则是定制的,可能由“技术主管”编写,以防止您将实例变量添加到单例类中,例如 Struts 1 Actions、EJB Statless SessionBean 和(Tapestry?)RequestHandler。
如果您将服务注入到操作中,那么您是对的,您的技术主管应该完善他的规则。可能有某种方法可以添加不会触发规则的服务依赖项,但现在只有技术主管才会这样做(以及开发指南,如果您有的话......)
This rule is a customized one, probably written by the "tech lead" to prevent you from adding instances variables into singleton classes such as Struts 1 Actions, EJB Statless SessionBean, and (Tapestry ?) RequestHandler.
If you're injecting a service into an action, you're right and your tech lead should refine his rule. There may be some way to add service dependencies which do not fire the rule though, only the tech lead will now this (and the developpment guide if you have one...)