[cdi-dev] [JBoss JIRA] (CDI-420) add a bean-discovery-mode 'scoped'

Martin Kouba (JIRA) issues at jboss.org
Tue Feb 2 03:19:00 EST 2016


    [ https://issues.jboss.org/browse/CDI-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13157413#comment-13157413 ] 

Martin Kouba commented on CDI-420:
----------------------------------

bq. The only difference in practice is to create the AnnotatedType + fire the PAT events...
Well, if a bytecode scanning lib such as [jandex|https://github.com/wildfly/jandex] is used then a user may supply a pre-built index and you only need to load the index from the jar to be able to skip irrelevant classes. But you're right that the difference probably will not be significant.
bq. But the huge benefit is that most CDI Extensions would work...
Maybe we should build a list of extensions not working with {{annotated}} and add a FAQ entry on [http://cdi-spec.org/]?
bq. Regarding using @WithAnnotations as input for the scanner. Imo that would be a chicken-egg problem.
Well, even now an extension is allowed to add a bean defining annotation, see for example {{BeforeBeanDiscovery.addStereotype()}}. But you're right that it's problematic (Weld does not support this in all environments atm).
bq. How about bean-discovery-mode = 'scanning'...
Sounds better. Let's continue with ideas. What about {{activated}} in the sense that a type is activated if it has a bean defining annotation after the type discovery finished?

> add a bean-discovery-mode 'scoped'
> ----------------------------------
>
>                 Key: CDI-420
>                 URL: https://issues.jboss.org/browse/CDI-420
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Packaging and Deployment
>    Affects Versions: TBD
>            Reporter: Mark Struberg
>             Fix For: 2.0 (discussion)
>
>
> This is for some future CDI release.
> We currently only have 3 bean-discovery-modes
> * none
> * all
> * annotated
> The spec also currently says that ProcessAnnotatedType will only get fired (12.4) for 
> • each Java class, interface or enum deployed in an explicit bean archive, and 
> • each Java class with a bean defining annotation in an implicit bean archive. 
> • each session bean
> Which means that we do not get the ProcessAnnotatedType (PAT) event for any class in an 'annotated' or 'implicit' BDA which does _not_ have a bean defining annotation. 
> It might be useful to fire the ProcessAnnotatedType for all classes, but do not pick them up as Beans if they (after PAT) do not have a valid scope. Effectively doing the processing but not make them @Dependent automatically if there is no scope annotation at the end of the PAT processing.
> I'm not yet 100% sure how important this distinction is in practice. Just writing this up to not forget about the idea...



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the cdi-dev mailing list