[cdi-dev] explicit bean archives discovery-mode 'annotated'

Martin Kouba mkouba at redhat.com
Thu Mar 5 02:54:57 EST 2015


Hi Mark,

First of all you're talking about _implicit_ bean archives - explict 
bean archive contains a beans.xml with bean-discovery-mode of all, with 
no version number or an empty file.

With regard to usability (from the extension developer point of view) - 
could you give some practical examples? AFAIK it's really useful from 
the app developer point of view.

Dne 4.3.2015 v 20:25 Mark Struberg napsal(a):
> Hi!
>
> I think I’ve implemented the behavour the spec defines - but it does not make much sense.
>
> First let’s look at the spec:
>
> 11.5.6. ProcessAnnotatedType event
> The container must fire an event, before it processes a type, for every Java class, interface
> (excluding the special kind of interface declaration annotation type) or enum DISCOVERED
> as defined in Section 12.4.1, “Type discovery”
>
> 12.4.1 defines…
> First the container must discover types. The container discovers:
> • each Java class with a bean defining annotation in an implicit bean archive.
>
>
> And in 2.5 we can read
> "f the bean discovery mode is annotated then:
> • bean classes that don’t have bean defining annotation (as defined in Section 2.5.1, “Bean defining annotations”) and are not bean classes of sessions beans, are NOT DISCOVERED“
>
>
>
> Which to me means that for a BDA with discovery-mode = „annotated“ we ONLY must fire ProcessAnnotatedType for classes with bean defining annotations, and NOT for interfaces or enums.
> If this is true, then it is a huge mess for lots of CDI Extensions. It basically renders the ‚annotated‘ mode pretty much useless.
>
>
> What we really need instead is a mode which will not automatically make a @Dependent bean out of every class later. But I really would ‚discover‘ all classes in a BDA and pass them to ProcessAnnotatedType.
> Some way to fix this or do we have to wait for CDI-2.0 to repair CDI-1.1?
>
> LieGrue,
> strub
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>

-- 
Martin Kouba
Software Engineer
Red Hat, Czech Republic


More information about the cdi-dev mailing list