-
1. Re: CDI 1.0 Activate @Alternatives in antoher jar.
rhanus Jun 27, 2013 8:50 AM (in response to suikast42)classes from jars located at ear/lib folder are visible to ejbs and wars by default you don't need to provide additional configuration
in your case you need to ensure that deltaspike modules at ear/lib folder have (at least empty) META-INF/beans.xml descriptor available and appropriate (ejbjar | war) archive has (META | WEB)-INF/beans.xml with desired alternative defined:
<beans>
<alternatives>
<class>...</class>
</alternatives>
</beans>
-
2. Re: CDI 1.0 Activate @Alternatives in antoher jar.
suikast42 Jun 28, 2013 5:39 AM (in response to rhanus)Hi Radim,
that can be. For my case, the artifact deltaspike-jpa-module-impl.jar (version 0.4) has a beans.xml which is shown below:
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>
</interceptors>
</beans>
So the Interceptor is activated here. If I hack the alternative in this beans.xml then everything works fine. But I can't controll this from outside of the jar. Should I assume as a bug in deltaspike?
-
3. Re: CDI 1.0 Activate @Alternatives in antoher jar.
rhanus Jun 28, 2013 12:41 PM (in response to suikast42)Hi Sueleyman,
maybe I finally see the problem
if TransactionInterceptor is used inside deltaspike library and you need to change its injected field from the default to an anternative implementation then you should configure desired alternative inside deltaspike's beans.xml
in beans.xml application deployer may activate interceptors/alternatives so I don't thing it's a bug in deltaspike
-
4. Re: CDI 1.0 Activate @Alternatives in antoher jar.
suikast42 Jul 1, 2013 3:20 AM (in response to rhanus)Hi Radim,
yes you're right. I have tried this aproach before I start this thread. But I mean that's a hack if I must mdidify the beans.xml from a third party dependecy. Isn't that so ?
-
5. Re: CDI 1.0 Activate @Alternatives in antoher jar.
rhanus Jul 1, 2013 4:48 AM (in response to suikast42)that's not a hack
you do the same for instance as an application deployer in case of ejbs when you are supposed to modify ejb referencies in ejb-jar.xml to fit at target environment
-
6. Re: CDI 1.0 Activate @Alternatives in antoher jar.
suikast42 Jul 1, 2013 5:10 AM (in response to rhanus)And how should I integrate this in my automated deployment structure? Has maven a plugin which can modify beans.xml of a dependency automatically ?
-
7. Re: CDI 1.0 Activate @Alternatives in antoher jar.
rhanus Jul 2, 2013 4:00 AM (in response to suikast42)no idea I don't use maven as build tool
-
8. Re: CDI 1.0 Activate @Alternatives in antoher jar.
suikast42 Jul 2, 2013 4:42 AM (in response to rhanus)I can live with ant too. I can trigger it from maven :-)
-
9. Re: CDI 1.0 Activate @Alternatives in antoher jar.
rhanus Jul 2, 2013 4:54 AM (in response to suikast42)I fell in love with gradle
these maven headaches can be easily solved by groovy scripts