We should probably review on cdi-dev.  I believe the intention behind
saying "classes discovered"  [1] is to indicate that its for all classes,
not just eligible beans.  Here's a use case: I have framework specific
classes, where the developer isn't required to add a scope.  Framework adds
the scope for them.  To do that, they use bean-discovery-mode=annotated and
PAT will add the dependent or other scope as appropriate.

[1]:
https://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#process_annotated_type

On Sat, Jul 22, 2017 at 5:40 PM Mark Struberg <[email protected]>
wrote:

> 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 <[email protected]
> >:
> >
> > 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" <[email protected]> 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 <
> [email protected]>
> >> 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" <[email protected]> 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