On Fri, Jan 1, 2010 at 11:32 AM, Gavin King <gavin.king@gmail.com> wrote:
Yes, unfortunately there are two @ManagedBean annotations in EE6,
neither of which are especially useful when you're using CDI. I
personally argued against having either of them, but my view was not
adopted.

I hope we "prune" the whole javax.faces.bean package out of EE7.

Just before the holiday break, we had a long conversation about this topic on the JSR-314 mailinglist. Everyone who responded agreed with this motion, so informally, you have the approval from the JSR-314 EG.

In that discussion, we came to the following conclusions:

For your programming model, use CDI (platform managed beans) or provide your own alternative bean container, such as Spring. We (JSR-314) are in the business of creating a UI component model, not a programming model.

What we all agree on (including the Spring guys) is what we don't recommend, the JSF managed bean container. What we can both get behind is a common set of annotations to hook into stronger bean containers such platform managed beans + CDI or platform managed bean annotations with Spring. @javax.inject.Named + @javax.inject.Inject, hoping for some common ground with the scope annotations.

With regard to the last comment, we could almost come to an agreement on the EG about how to show "managed beans" in JSF examples that was neutral to CDI and Spring, except for the scope annotations. Jeremy asked why there wasn't alignment on the scope annotations. Why can't we have just one platform-wide RequestScoped, SessionScoped and ApplicationScoped annotations? I couldn't completely answer his question.

Understand that my motivation here is to be able to show a JSF "managed bean" class that uses annotations that we can all get behind, so that we can stop using javax.faces.* in documentation (and be diplomatic).


However, note that @javax.annotation.ManagedBean is *already*
integrated with CDI, since we say:

"A top-level Java class is a managed bean if it is defined to be a
managed bean by any other Java EE specification, or if it meets all of
the following conditions..."

Yep. What I've been saying is that this annotation should really be a formality that the end developer should never see because CDI is more or less applying it transparently (or implying it is there).

Btw, the name attribute on @javax.annotation.ManagedBean is practically useless. No reasonable developer is going to go looking into JNDI to find beans. Again, another low-level detail.

-Dan

--
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