EJB 实现外部库的接口

发布于 2024-12-28 22:11:18 字数 155 浏览 1 评论 0原文

我有一个 java 类,它实现了外部库的接口。 我通过使用 @Stateless 注释将该 java 类转换为 EJB。 我将其转换为 EJB 的原因是为了利用依赖项注入并获取 EntityManager API 的句柄。但我无法将此无状态 bean 注入其他 EJB。

I have a java class which implements an interface from an external library.
I converted this java class into an EJB by anotating with @Stateless.
The reason I converted this to an EJB is for leveraging the dependency injection and to get an handle for EntityManager API. But I am not able to inject this Stateless bean into other EJBs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

寂寞笑我太脆弱 2025-01-04 22:11:18

您是否尝试过使用 @Stateless@Local 来注释您的 EJB?它应该包含接口的名称作为值:@Local(MyBeanInterface.class)

Have you tried to annotate your EJB with @Stateless and @Local too? It should contain the name of the interface as value: @Local(MyBeanInterface.class)

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