users@glassfish.java.net

Re: [FishCAT] CDI 1.1: How to exclude an archive from scanning?

From: Harald Wellmann <hwellmann.de_at_gmail.com>
Date: Tue, 7 May 2013 16:45:26 +0200

Tom, I can't add a beans.xml to a third-party JAR. That's why I use the
global switch, which works fine in my case.

Of course this will not work when different third-party JARs make different
assumptions about implicit beans. So it would be helpful if GlassFish (or
Weld) offered a way to enable or disable implicit scanning per JAR.

Best regards,
Harald


2013/5/6 Tom Snyder <tom.snyder_at_oracle.com>

> Hi Harald,
>
> Please be aware the *enable-implicit-cdi* config setting turns off
> implicit scanning for all archives in the entire server. If you want to do
> it per archive, you can add a beans.xml with a bean-discovery-mode of none.
>
> Hope this helps,
>
> - Tom
>
> On May 6, 2013, at 1:00 PM, Harald Wellmann <hwellmann.de_at_gmail.com>
> wrote:
>
> Digging in the sources, I found this new setting for domain.xml that seems
> to be doing the trick:
>
> <cdi-service enable-implicit-cdi="false"/>
>
> Best regards,
> Harald
>
>
> Am 05.05.2013 22:02, schrieb Harald Wellmann:
>
> Does GlassFish 4.0 or Weld 2.0 offer an option to prevent an archive
> from being scanned for managed beans?
>
> CDI 1.1 section 12.1 only states:
>
> "For compatibility with Contexts and Dependency 1.0, products must
> contain an option to cause an archive to be ignored by the container
> when no beans.xml is present."
>
> I'm having problems with a web app containing guava-14.0.jar in
> WEB-INF/lib which has a class annotated with javax.inject.Singleton, so
> it gets treated as an implicit bean archive, which causes an exception.
>
> Best regards,
> Harald
>
>
>
>
>