Java EE 6 CDI 实现之间的差异
我查看了 JBoss 的 JSR-299 上下文和依赖注入的 Weld 参考实现,我想知道其他 CDI 实现之间的比较。 具体来说,我了解 Weld、Resin CanDI(由 Caucho 开发)和 Apache OpenWebBeans。
I've looked at JBoss' Weld Reference Implementation of JSR-299 Contexts and Dependency Injection, and I wanted to know how others CDI implementations compare to each other.
Specifically, I know about Weld, Resin CanDI (by Caucho), and Apache OpenWebBeans.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
主角快速概述:
因此,如果我在撰写本文时必须选择一种实现,我会选择 RI(即 Weld),因为它已经准备好并且可以“独立”使用(准备好并不意味着它已被广泛使用)。
如果您正在寻找一些性能比较(您还想比较什么?),我认为您现在找不到这样的基准。
无论如何,如果你想使用CDI,就这么做吧。
Quick overview of the protagonists:
So, if I had to pick one implementation at the time of writing this, I would pick the RI (i.e. Weld) because it's ready and can be used "standalone" (ready doesn't mean it has been widely used).
If you're looking for some performance comparison (what else would you like to compare?), I don't think you will find such a benchmark for now.
In any case, if you want to use CDI, just do it.
事实上,我已经在一个真正的生产性政府项目中使用了 OpenWebBeans,以及一个成熟的 EE6 Web Profile 环境。但我不会告诉你在哪里,所以它不能得到斜线;)(顺便说一句,请做好准备,大多数 EE-6 部分,例如 EL-2.2 集成,目前需要大量小补丁和调整才能运行 -但它看起来确实很有前途!)
事实上,Weld 和 OpenWebBeans 社区经常相互沟通,因此每当我们遇到规范中未明确列出的问题时,我们都会尝试进行讨论。由于参与其中的 Caucho 人 Ferg 和 Reza 都可以说是 java 之神,我敢打赌他们的实现也非常好;)
至于 OpenWebBeans:我们目前正在准备 Milestone4 版本,应该会在下周发布。
openwebbeans-impl 又名“owb-core”几乎没有任何依赖关系!
所有“较重”的依赖项均由嵌入式插件处理,这些插件会自动从类路径中获取(如果可用)。当涉及到与其他 EE 部分交互时,它们涵盖了规范的某些部分。例如,有像 openwebbeans-jsf、openwebbeans-jms、openwebbeans-resource(处理 EE 资源 + JPA)等插件
顺便说一句:不要错过编写自己的便携式程序的美妙简单方法! CDI 扩展。
要获得第一个想法,您可以查看
Seam3:anonsvn.jboss.org/repos/seam/modules/
当然
Apache MyFaces CODI:github.com/struberg/myfaces-ext-cdi
(很快就会迁移到 Apache MyFaces SVN)
LieGrue,
斯特鲁布
Actually I use OpenWebBeans in a really productional Government project already, together with a full blown EE6 Web Profile environment. But I won't tell you where, so it cannot get slashdotted ;) (Btw, be prepared that most of the EE-6 parts, like e.g. EL-2.2 integration currently needs a lot of small patches and tweaks to get up running - but it really looks promising!)
In fact the Weld and OpenWebBeans communities are communicating with each other pretty often, so whenever we hit something not clearly lined out in the spec, we both try to discuss things out. And since the involved Caucho guys Ferg and Reza are both simply said java gods, I bet their implementation is really good as well ;)
As for OpenWebBeans: we are currently preparing a Milestone4 release which should get released next week.
The openwebbeans-impl aka 'owb-core' has almost no dependencies at all!
All 'heavier' dependencies are handled by drop-in plugins which get automatically picked up from the classpath if available. They cover certain parts of the spec when it comes to interacting with other EE parts. There is e.g plugins like openwebbeans-jsf, openwebbeans-jms, openwebbeans-resource (handling EE resources + JPA), etc
Btw: don't miss the wonderful easy way to write your own portable! CDI extensions.
To get a first idea, you might look at
Seam3: anonsvn.jboss.org/repos/seam/modules/
and of course
Apache MyFaces CODI: github.com/struberg/myfaces-ext-cdi
(will get move to Apache MyFaces SVN soon)
LieGrue,
strub
目前他们不进行比较。我怀疑它们中的任何一个是否已用于生产,它们太新鲜了。
Currently they don't compare. I doubt any of them has been used in production, they're too fresh.
就CDI规范而言,我希望RI之间不会有任何功能差异。
查看这篇文章:了解 Java EE 6 和CDI
As long as the CDI specification is concerned, I hope there will not be any functional difference among RIs.
Check this article: Understanding Java EE 6 and CDI
我想说的是相反的;)但这两个项目都是优秀的工具,并且配备了不同的应用程序服务器。关键是两者都遵循 Java EE 规范,并在编程灵活性和重用方面提供了令人难以置信的强大功能。
I would have said the opposite ;) But both projects are excellent tools and come provided with different application servers. The key is that both follow the Java EE specification, and provide incredible power in programming flexibility and reuse.