Loading Spring Module in JBoss EAP through Apache CXF module
sergiopolog Apr 20, 2017 4:45 AMI have a question regardind behavior JBoss EAP has when loading static modules.
In particular, my question is that what happens when I need Apache CXF to use in my webapp and integrate it with Spring, and I have two Spring modules created in JBoss, each one with different Spring version. See:
Version: 3.2.18.RELEASE created at: {JBOSS_ROOT}\modules\org\springframework\spring\3.2.18.RELEASE (for my application):
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.springframework.spring" slot="3.2.18.RELEASE"> <resources> <resource-root path="aopalliance-1.0.jar"/> <resource-root path="spring-aop-3.2.18.RELEASE.jar"/> <resource-root path="spring-beans-3.2.18.RELEASE.jar"/> <resource-root path="spring-context-3.2.18.RELEASE.jar"/> <!-- .... ---> </resources> <dependencies> <module name="org.apache.commons.logging"/> <module name="javaee.api"/> <module name="org.jboss.vfs"/> </dependencies> </module>
And
Version: 4.2.4.RELEASE (for other application already deployed in JBoss):
as main: {JBOSS_ROOT}\modules\org\springframework\spring\main (for another application already deployed):
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.springframework.spring"> <resources> <resource-root path="aopalliance-1.0.jar"/> <resource-root path="spring-aop-4.2.4.RELEASE.jar"/> <resource-root path="spring-beans-4.2.4.RELEASE.jar"/> <resource-root path="spring-context-4.2.4.RELEASE.jar"/> <!-- .... ---> </resources> <dependencies> <module name="org.apache.commons.logging"/> <module name="javaee.api"/> <module name="org.jboss.vfs"/> </dependencies> </module>
However built-in Apache CXF module within JBoss depends on Spring Module, but not especifies version (so takes `main`):
<dependencies> <module name="org.springframework.spring" optional="true"> <imports> <include path="META-INF"/> </imports> </module> </dependencies>
How can I use Apache CXF in my application but also using my Spring version?. I tried with jboss-deployment-structure.xml like this:
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"> <ear-subdeployments-isolated>false</ear-subdeployments-isolated> <deployment> <exclude-subsystems> <subsystem name="jaxrs"/> <subsystem name="webservices"/> </exclude-subsystems> </deployment> <sub-deployment name="myapp.war"> <local-last value="true"/> <dependencies> <module name="org.apache.cxf"/> <module name="org.apache.cxf.impl" meta-inf="import"/> <module name="org.springframework.spring" meta-inf="import" slot="3.2.18.RELEASE"/> <module name="org.aspectj" /> <module name="org.slf4j"/> </dependencies> </sub-deployment> </jboss-deployment-structure>
Is there another workaround? (I've thought modify module.xml from apache cxf to point my version, but it causes to stop working the other application, obviously)
Environment: JBoss EAP 6.4
Thanks!