Maven 与 Spring 注入

发布于 2024-11-17 10:54:54 字数 337 浏览 0 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷默言语 2024-11-24 10:54:54

该规则是定制的,可能由“技术主管”编写,以防止您将实例变量添加到单例类中,例如 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...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文