停止容器加载 EJB

发布于 2024-11-28 13:42:48 字数 210 浏览 2 评论 0原文

我有一个数据访问 EJB 项目,其中有许多 EJB,我想在多个项目中使用此模块来利用一些常见的类,但是,我并不总是希望加载项目中的 EJB。更具体地说,我只想为某些项目加载某些 EJB。除了将项目拆分为多个 EJB 模块并将公共类放在核心库中之外,我还能做些什么。

项目中的大多数 EJB 位于@Singleton 并初始化@Startup。

谢谢,

詹姆斯

I have a data access EJB project that has a number of EJB's I want to use this module across a number of projects to make use of some common classes however, I don't always want the EJB's in the project to be loaded. More specifically I only want certain EJB's to be loaded for certain projects. Other than splitting the projects in to multiple EJB modules and have the common classes in a core library is there anything I can do.

Most of the EJB's in the project at @Singleton and initialised @Startup.

Thanks,

James

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

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

发布评论

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

评论(2

始终不够爱げ你 2024-12-05 13:42:48

詹姆斯,我想我确实理解你想要实现的目标,但这对我来说没有意义。如果您想要共享某些类而不共享 EJB 本身,则应该创建一个包含您想要共享的类的实用程序 JAR。这不仅是一种解决方法,而且是一种最佳实践,因为它可以解耦事物。

James, I think I do understand want you want to achive, but this does not make sense to me. If you want to share certain classes without sharing the EJBs itself, you should create a Utility JAR containing those classes you want to share. This is not only a workaround, but a best-practice as it decouples things.

生死何惧 2024-12-05 13:42:48

我从未见过或听说过有选择地加载属于同一 EAR 的 EJB 的能力。

如果这确实是一个要求,也许您可​​以在公共项目中仅包含共享库和样板代码(如 DAO),并将各个数据访问外观重构到它们所引用的项目中。

I've never seen or heard of the ability to selectively load EJB's that belong to the same EAR.

If this is really a requirement, perhaps you can include only your shared libraries and boilerplate code (like a DAO) in the common project and refactor the individual data access facades into the projects they're referenced by.

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