停止容器加载 EJB
我有一个数据访问 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
詹姆斯,我想我确实理解你想要实现的目标,但这对我来说没有意义。如果您想要共享某些类而不共享 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.
我从未见过或听说过有选择地加载属于同一 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.