To sum it up:
-
It's definitely a non-portable use-case, see also 12.1. Bean archives for CDI 1.0 and 12.1. Bean archives for CDI 1.2
-
It's not supported by Weld 1.x (JBoss EAP 6.x)
-
It would work in Weld 2.x (WildFly 8+), however in CDI 1.1+ a built-in bean with the same type is provided, see also 3.8. Additional built-in beans - and that's the real cause of ambiguous dependency on WildFly
-
The only portable solution is to place the shared library into the EAR/lib directory
-
For Weld 2.x it's also necessary to use a qualifier to distinguish the built-in and user-provided beans
-
If you just use a custom qualifier and don't place the lib accordingly, it's still non-portable but it should work on WildFly 8+
-
For Weld 1.x the fact that "qualifier workaround" works is rather a coincidence (1) and should not be used at all
(1) The resolution probably works because there are two different qualifier annotation classes Sync (for each WAR).
|