将 GWT 与 CDI(接缝/焊接)集成
将 CDI 与 GWT 集成的最佳方式是什么?特别是,我想知道如何使依赖注入适用于我的 RemoteServiceServlet 扩展。显然,CDI 不适用于从 javax.servlet.Servlet 派生的类。如果有替代方案,我很乐意放弃 RemoteServiceServlet。
我确实不需要 GWT 客户端上的 DI,但如果它能正常工作,我会很乐意使用它。
What's the best way to integrate CDI with GWT? In particular, I'd like to know how to make dependency injection work for my RemoteServiceServlet extensions. Apparently CDI won't work with classes derived from javax.servlet.Servlet. I'm happy to ditch RemoteServiceServlet if there is an alternative.
I don't really need DI on the GWT client-side, but would happily use it if it Just Worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明这是一个 Weld 中的错误,已在 1.1.0 版本中修复。
Intellij IDEA X 也有这个“bug”,因为如果您尝试使用 RemoteServiceServlet 执行此操作,它会将其标记为错误。我只是禁用了检查。
It turns out to be a bug in Weld, which is already fixed in version 1.1.0.
Intellij IDEA X also has this "bug", as it flags it as an error if you try to do this with a RemoteServiceServlet. I just disabled the inspection for that.
我相信如果您想将 CDI 与 GWT 集成,Errai 就是您所寻找的。我自己还没有在实际项目中使用过它,但它看起来真的很酷。它甚至可以在浏览器和服务器之间桥接 CDI 事件,并且几乎可以取代现有的 GWT RPC 机制。
I believe Errai is what you're looking for if you want to integrate CDI with GWT. I haven't used it myself on a real project but it looks really cool. It will even bridge CDI events between the browser and your server and can pretty much replace the existing GWT RPC mechanism.