[jsr-314-open] getting behind CDI

Dan Allen dan.j.allen at gmail.com
Wed Dec 23 01:08:09 EST 2009


David,

I'm going to disappoint you slightly because I don't think this list is the
appropriate place to compare Spring 3.0 and CDI. I would like to avoid an
unbounded thread, which these things inevitably turn into. My best advice
for you is to simply evaluate the two reference guides and post your
conclusions.

What I will say is that the relevance (I'm avoiding the term "benefit") of
CDI is that it's bundled in the Java EE 6 platform, giving the platform a
bean container for the first time. Well, okay, there was a half-hearted
attempt at a bean container prior to that. Really, it was just a specialized
bean container that only supported one type of bean (EJBs) and a fixed set
of platform-bound resource injections (@PersistenceContext, @Resource, etc).
Granted, there are still some bumbs to be worked out across the platform.
But the steps that were taken in Java EE 6, most notably that it now has a
bean container, are pretty damn monumental.

What's more, for the first time ever, it's possible to extend Java EE using
the CDI extension SPI. That means you can add/modify/remove beans,
interceptors, decorators, qualifiers, etc. at startup time, get information
about the runtime, and other sorts of tweaking. You could call it Tweak EE
(playing off of Tweak UI).

So if something isn't working out for you, it's certainly possible that an
extension will be able to fill in the void. I'd go so far as to say that a
framework like Spring could leverage the extension SPI heavily to integrate
itself into Java EE if the developer was looking for that type of bridge.
(Experience will tell us if that is true). There are certainly places in
Spring today that it has to go searching for information that now the CDI
extension SPI could provide for it for free.

That's my brief sketch of CDI. The advantage that Spring has is that it's
incredibly well-known and, well, it's at version 3.0. It wouldn't really be
a balanced equation to compare Spring with CDI anyway, since Spring is so
much more than just a bean container. If you did a head-to-head comparison,
it would have to be with Spring core (and the Java EE integration). But I
don't want to partake in that comparison on this list, as I mentioned
before. Besides, it's the holiday and we don't want to create a long thread
to distract folks from their presents (and family).

-Dan

On Sun, Dec 20, 2009 at 7:33 PM, David Geary <clarity.training at gmail.com>wrote:

> I've found this a fascinating thread. I didn't know that Spring 3.0 had
> many of the same features as CDI.
>
> So I can intelligently recommend either Spring 3 or CDI, I'd like to know
> what are the advantages and disadvantages of each. I read the comments on
> TSS (<http://www.theserverside.com/news/thread.tss?thread_id=58858#330454>),
> and from that thread I surmised that Spring 3.0 and CDI were similar, but I
> don't understand the differences. I appreciate, btw, the much more cordial
> discussion Dan and Jeremy have had on this list.
>
> Dan and Jeremy, it'd be great if you guys could let us know what the pros
> and cons of each are.
>
> Thanks,
>
>
> david
>
>
-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://www.google.com/profiles/dan.j.allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20091223/e5e7ea33/attachment.html 


More information about the jsr-314-open-mirror mailing list