-
1. Re: WELD-000132: Disabled alternative
mkouba Aug 16, 2018 6:28 AM (in response to gergely.hegyi)Hi Hegyi,
when you use beans.xml to enable/select an alternative it's only selected locally, i.e. in the bean archive where the beans.xml resides.
@Priority
, on the other hand, selects the alternative globally, i.e. the alternative is selected for the application. How does you deployment look like? Is the beans.xml located in the same bean archive as the bean which attempts to inject a Validator? -
2. Re: WELD-000132: Disabled alternative
gergely.hegyi Aug 22, 2018 5:22 AM (in response to mkouba)Hi Martin,
Thank you for your answer.
My answer is: No. The interface, primary bean and mock is in Common.jar. The beans.xml in war.
I tried that way: The interface, primary bean is in Common.jar. The beans.xml and mock are in war. But it doesn't work too.
We have many maven profile in WAR build. And some profile use different alternative set. And thees profiles copy own beans.xml to the right place. This is why beans.xml located in war package.
G.
-
3. Re: WELD-000132: Disabled alternative
manovotn Aug 23, 2018 5:10 AM (in response to gergely.hegyi)Hi,
since the enablement via beans.xml is on a per bean archive basis, you need to have that alternative defined in the beans.xml which resides in the same archive as the bean which does @Inject Validator.
Otherwise you need to use priority or probably leverage extensions in some way.
Where does the bean injecting Validor reside? In common.jar?
-
4. Re: WELD-000132: Disabled alternative
gergely.hegyi Aug 23, 2018 12:11 PM (in response to manovotn)yes, in common.jar as well.
-
5. Re: WELD-000132: Disabled alternative
manovotn Aug 24, 2018 3:07 AM (in response to gergely.hegyi)I see, that won't work. So you can either:
1) Keep the beans as they are and move your current beans.xml enablement into common.jar as well
2) Keep beans.xml in WAR but move bean which does @Inject Validator into WAR as well.
3) Use @Priority as a means of enabling alternative (but that has global effect)
-
6. Re: WELD-000132: Disabled alternative
gergely.hegyi Aug 24, 2018 4:56 AM (in response to manovotn)Thanks you for your answers guys!
Cheers!