如何将一个 EJB 3.1 注入另一个 EJB
我正在开发一个简单的应用程序,其中一个 EJB 应该注入到另一个 EJB 中。我正在 IDEA Jetbrains IDE 中进行开发。但是当我在 Ejb 本地无状态类中添加 @EJB 注释后,我的 IDE 会错误地突出显示它: 未找到带有组件接口“ApplicationController”的 EJB“”。
谁能告诉为什么?
I'm developping simple app where one EJB should be injected into another. I'm developping in IDEA Jetbrains IDE. But after i make @EJB annotation in Ejb local statless class my IDE highlight it with error:
EJB '' with component interface 'ApplicationController' not found.
Can anyone tell Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以使用@EJB 注释将一个EJB 引用注入到另一个EJB 中。以下示例取自注入其他 EJB 示例来自 OpenEJB 文档:
如果它没有按预期工作,也许会显示一些代码。
Injection of an EJB reference into another EJB can be done using the
@EJB
annotation. Here is an example taken from Injection of other EJBs Example from the OpenEJB documentation:If it doesn't work as expected, maybe show some code.
我相信这是一个 IntelliJ IDEA 错误。 此线程为我解决了问题:
I believe it's an IntelliJ IDEA bug. This thread solved the problem for me: