[cdi-dev] explicit bean archives discovery-mode 'annotated'
struberg at yahoo.de
Thu Mar 5 09:20:18 EST 2015
> Am 05.03.2015 um 14:14 schrieb Antoine Sabot-Durand <antoine at sabot-durand.net>:
>> Le 5 mars 2015 à 09:28, Mark Struberg <struberg at yahoo.de> a écrit :
>> Well, the terms ‚explicit‘ and ‚implicit‘ BDA are blurry as well. I _explicitly_ add a beans.xml with version=1.1 and bean-discovery-mode=„annotated“ and still it is an ‚implicit‘ BDA according to those definitions. Not very self-explaining but anyway. Has not much to do with the current topic as well, so not sure why you mentioned it?
> It’s the other way around. Implicit bean archive behave as if they have a beans.xml with version 1.1 and “annotated” bean-discovery mode.
Sorry Antoine, what I wrote is imo correct according to the correct spec wording.
Please read 12.1:
"An explicit bean archive is an archive which contains a beans.xml file:
• with a version number of 1.1 (or later), with the bean-discovery-mode of all, or,
• with no version number, or,
• that is an empty file.“
The important part is „with the bean-discovery-mode of ALL“. So if it does have a different bean-discovery-mode (here: annotated) then it is NOT an explicit bean archive and is falls under the subsumption of the follow up paragraph:
"An implicit bean archive is any other archive which contains one or more bean classes "
So according to the current wording (has been there that way since CDI-1.1) a jar with a beans.xml with bean-discovery-mode=„annotated“ is an ‚implicit bean archive‘. Maybe ‚annotated‘ is just missing in the first sentence?
> Yes, that’s why you shouldn’t use annotated discovery mode if you want to do serious stuff in CDI.
Well that’s the same like saying „sorry folks, we fucked it up. Use something different.“ :)
The main reason for all this is to reduce the amount of beans by not picking up every damn class on the classpath as @Dependent scoped bean.
More information about the cdi-dev