Java EE 6 CDI 实现之间的差异

发布于 2024-08-21 20:35:15 字数 129 浏览 14 评论 0原文

我查看了 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 技术交流群。

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

发布评论

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

评论(5

少女七分熟 2024-08-28 20:35:15

主角快速概述:

  • Weld 是 RI(只有一个 RI),1.0 版已发布,它内置于 GlassFish v3 和即将推出的 JBoss AS EE 6 中,但也可以与 < a href="http://docs.jboss.org/weld/reference/1.0.0/en-US/html/environments.html#d0e4910" rel="noreferrer">其他容器(有一些限制)。
  • OpenWebBeans 仍在开发中,版本 1.0.0 计划于 2010 年 4 月底发布。Caucho
  • CanDI 似乎与 Resin 相关(我在这里可能是错的,但我找不到任何明确的证据证明在他们的网站上相反,无论如何这都很糟糕)。

因此,如果我在撰写本文时必须选择一种实现,我会选择 RI(即 Weld),因为它已经准备好并且可以“独立”使用(准备好并不意味着它已被广泛使用)。

如果您正在寻找一些性能比较(您还想比较什么?),我认为您现在找不到这样的基准。

无论如何,如果你想使用CDI,就这么做吧。

Quick overview of the protagonists:

  • Weld is the RI (there is only one RI), version 1.0 is out, it is built into GlassFish v3 and the upcoming JBoss AS EE 6 but can also be used with other containers (with some limitations).
  • OpenWebBeans is still under development, version 1.0.0 is planned for end of April 2010.
  • Caucho CanDI seems to be tied to Resin (I may be wrong here but I couldn't find any clear proof of the contrary on their website, which is bad anyway).

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.

她说她爱他 2024-08-28 20:35:15

事实上,我已经在一个真正的生产性政府项目中使用了 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

×眷恋的温暖 2024-08-28 20:35:15

目前他们不进行比较。我怀疑它们中的任何一个是否已用于生产,它们太新鲜了。

  • Weld 应该是参考实现,因为它是与规范负责人 Gavin King(来自 JBoss)个人密切合作开发的
  • ,我更喜欢 OpenWebBeans,因为它具有更简洁的代码,但这在使用时并不重要。

Currently they don't compare. I doubt any of them has been used in production, they're too fresh.

  • Weld is supposed to be the reference implementation, because it is being developed with close collaboration with the spec lead - Gavin King (from JBoss)
  • personally, I like OpenWebBeans more by virtue of having a bit cleaner code, but that's not important when using it.
葬シ愛 2024-08-28 20:35:15

就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

子栖 2024-08-28 20:35:15

我想说的是相反的;)但这两个项目都是优秀的工具,并且配备了不同的应用程序服务器。关键是两者都遵循 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.

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