[webbeans-dev] Re: XML configuration format

Gavin King gavin at hibernate.org
Sun Dec 21 14:59:07 EST 2008


>  1) The inline bean vs property needs to be simplified.  (9.5 injection
> point declarations), specifically the existence of a child element should
> not affect the parsing.  Instead, it should follow the method model (9.2.6)
> where "has a direct child <Initializer>, ..., or binding type."  9.5 should
> be rewritten as:
>
>     a) If the Java type is a parameterized type .... is a type declaration
>     b) Otherwise if ... binding type ... is a type declaration
>     c) Otherwise, the injection point declaration is an inline Web Bean
> declaration, and the declared type ...
>
> i.e. removing the old 3rd rule because it was making things more confusing.
>  The slight extra verbosity by requiring <Current/> for an injected type is
> outweighed by the simplification, and consistency with 9.2.6.

This change would amount to *always* having to specify <Current/> in
the common case where an injection point is not an inline Web Bean
definition. I'm really not keen on that.

> The specific problem is: when does an XML element refer to a type and when
> does it refer to a bean to be instantiated (9.6 vs 9.7), which isn't obvious
> from the spec (it's well-defined, but can be simplified.)

If we do change these rules, I think it would be much better to introduce a
special tag to indicate that it is an inline Web Bean definition, for example
<Define>...</Define> or something like that.

>  2) Property injection (bean-style setters) really need to be supported.
>  The bean pattern is historic and embedded in essentially all
> specifications, so it's not really something WebBeans can avoid.  Aside from
> the historic value, property injection lets you validate input easily at the
> configuration point, which is very nice.

I'm inclined in this direction for another reason: I want to be able to say
(at some point in the future) that @PersistentContext, @Resource, etc,
are just Web Beans binding types. That's possible if we have setter
injection, but it's not possible today.

However, it raises the issue of how we would distinguish setter injection
from field injection in the XML. Does:

    <my:foo>...</my:foo>

represent the field "foo" or the setter "setFoo()"? Or should property
injection look like:

    <my:setFoo>...</my:setFoo>

which works, but is not really "historic".

>  4) Annotation declaration is great.  I would like the ability to add
> non-webbeans annotations (for service declarations/introspection), but that
> non-critical and could certainly be put off until a later spec.

Yes, I would also like this facility, but also kinda useless without a full
metamodel API, which I think is something we're going to run out of
time to do, I'm afraid.


-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list