-
1. Re: Web Beans and patterns
gavin.king Jul 8, 2009 11:16 PM (in response to asookazian)
So if you want to write a DAO layer, which is typically a stateless JavaBean or SLSB implementation, would that be a Web Bean component or not typically?According to the spec, all JavaBeans and session beans are
web beans
(that's not the terminology we use anymore) so, yes.
But what if our SLSB DAO needs DI?All EJBs can inject stuff using 299. All session beans can be injected using 299.
-
2. Re: Web Beans and patterns
asookazian Jul 9, 2009 12:01 AM (in response to asookazian)In a Seam 2.x app, we designate a class (whether it's a session bean or JavaBean) as a Seam component using @Name("foo").
Now there is @Named in 299. What happens if we do not use @Named on our class? And what if I do not want a particular JavaBean or EJB to be a Web Bean? In Seam, we simply do not use the @Name annotation on the class and it's not scanned/installed as a Seam component into the Seam container during deployment of the app.
btw, the first reference to @Named is here:
2.4. Scopes
in the contexts-1_0-pfd-spec.pdf I just downloaded from jcp.org.
There is no explanation of that annotation until later (2.6.1). It should be explained at the first occurrence for obvious reasons (or call out the explanation deferment explicitly to section 2.6.1 where it is currently explained).
So from 2.6.1 it sounds like you use @Named so you can reference a bean in a JSF page directly. And thus it's optional.
This is somewhat confusing now that the term
web bean
has been eradicated from the latest spec.For example, in the very first section, Chapter 1. Architecture, it seems that some definitions are skipped.
This specification provides a powerful new set of services to Java EE components.
What exactly are Java EE components (Servlets, EJBs, JavaBeans?) and does 299 apply to all of them?
The lifecycle and interactions of *stateful components* bound to well-defined lifecycle contexts, where the set of contexts is extensible.
Again what exactly are the stateful components that are referred to here? SFSBs? Anything else?
It's almost like there needs to be a cross-reference or footnote to the EE 6 spec to clear some confusion here...
-
3. Re: Web Beans and patterns
asookazian Jul 9, 2009 12:11 AM (in response to asookazian)It would help to read the entire spec I suppose:
1.2. Relationship to other specifications An application developer creates Java EE components such as EJBs, servlets and JavaBeans and then provides additional metadata that declares additional behavior defined by this specification.