In that case Romain is right.

In an implicit BDA you only get PAT if the class has a bean defining annotation.
Thats the reason we introduced all+trim.

LieGrue,
Strub

> Am 21.07.2017 um 21:37 schrieb Romain Manni-Bucau <rmannibu...@gmail.com>:
> 
> Cause the scanning by itself is undefined, you can not scan skip not bean
> types and be spec compliant.
> 
> 
> Le 21 juil. 2017 21:26, "John D. Ament" <johndam...@apache.org> a écrit :
> 
>> Errr I'm not sure what you mean.  The spec states this "before it reads the
>> declared annotations" so I'm not sure why you think it needs to have a bean
>> defining annotation.
>> 
>> John
>> 
>> On Fri, Jul 21, 2017 at 3:21 PM Romain Manni-Bucau <rmannibu...@gmail.com>
>> wrote:
>> 
>>> Hmm, interesting edge case. For me it should be ignored until you make it
>>> scanned using @Dependent or so. But fear it is quite undefined or
>>> "interpretable"
>>> 
>>> Le 21 juil. 2017 21:10, "John D. Ament" <johndam...@apache.org> a écrit
>> :
>>> 
>>>> I do something really lazy, I have an extension that has this method on
>>> it:
>>>> 
>>>> public void findEntities(@Observes @WithAnnotations(Entity.class)
>>>> ProcessAnnotatedType<?> pat)
>>>> 
>>>> which just looks for entity classes.  They're not going to be CDI
>> beans,
>>>> but they are annotated types.  Per the spec,
>>>> https://docs.jboss.org/cdi/api/2.0/javax/enterprise/inject/spi/
>>>> ProcessAnnotatedType.html
>>>> ,
>>>> the event should get fired, even if there are no bean defining
>>> annotations.
>>>> 
>>>> Switching beans.xml to use bean-discovery-mode=all fixes it, but I'd
>>> prefer
>>>> to not discover these as beans.
>>>> 
>>>> Using a <beans bean-discovery-mode="all" version="2.0"><trim/></beans>
>>> does
>>>> fix it. But either way, my understanding is that PAT is always fired,
>> for
>>>> all classes found within a bean archive.
>>>> 
>>>> John
>>>> 
>>> 
>> 

Reply via email to