[
https://issues.jboss.org/browse/CDI-420?page=com.atlassian.jira.plugin.sy...
]
Martin Kouba commented on CDI-420:
----------------------------------
From the bootstrap performance point of view the {{annotated}} mode
allows much better optimization as you don't need to load "unsuitable"
classes and fire PAT at all (so if you really care about bootstrap time of a large
application, the workaround mentioned in one of the previous comments is the way to go).
Memory footprint would be the same compared to {{annotated}}.
Otherwise sounds good. Except for the mode name - "scoped" does not say much.
And you may end with a bean class picked up even if it does not define any scope at all
(e.g. if you add a stereotype annotation without scope to a class which previously has no
bean defining annotation declared).
Theoretically, we could also extend the meaning of {{@WithAnnotations}} and make all the
annotation values bean defining annotations. E.g. once you add an extension with PAT
annotated with {{(a)WithAnnotations(MessageBundle.class)}} then {{MessageBundle}} becomes a
bean defining annotation. Just an idea I haven't thought about this properly.
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)