[cdi-dev] explicit bean archives discovery-mode 'annotated'

Mark Struberg struberg at yahoo.de
Fri Mar 6 03:44:00 EST 2015

While we are at it: the ’none’ mode is broken as well ;)

Imagine you have a jar  in say DeltaSpike with a bean-discovery-mode=„none“.

Now let’s run this in CDI-1.1++ containers: all fine jar gets ignored
But in CDI-1.0 containers: whoops, due to having a beans.xml at all (marker interface) the container must scan this jar. 

There is simply no backward compatible way to tell the container that it should ignore a jar.


> Am 06.03.2015 um 09:15 schrieb Jozef Hartinger <jharting at redhat.com>:
> On 03/06/2015 09:03 AM, Romain Manni-Bucau wrote:
>> Hi
>> Well you cant ask libs to change their programming model for it IMO. It is clearly a regression.
> Why not? Existing applications (empty beans.xml) will still work as before so there is no regression. If a lib wants to support bean-discovery-mode="annotated" then it has to adapt. It would be better if they did not have to but it's too late at this point.
>> Another broken case is if any other IoC uses some of these annotations but doesnt rely on scanning. Now you scan the jar and can get surprises and even an Error.
> Yes, this was a risk when implicit bean archives were introduced. This was in the end mitigated by only making CDI annotations as bean defining (most likely other IoC won't use CDI annotations) plus introducing bdm="none" mode.

More information about the cdi-dev mailing list