views:

544

answers:

5

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.

A: 

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.
Bozho
+2  A: 

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.

Pascal Thivent
A: 

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 JEE specification, and provide incredible power in programming flexibility and reuse.

Lincoln
+1  A: 

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

A: 

As long as the CDI specification is concerned, I hope there will not be any functional difference among RIs. Check this article: Understanding JEE 6 and CDI

Puspendu Banerjee