问题
Spring-ws 1.5.9 depends on Spring 2.5 (based on the pom). Can it be used with Spring 3 without running into any classloading issues. I know that some of the packages match between the two, can I just not include those Spring 3 jars? I cant seem to find any official word on this.
回答1:
Officially, no, they're not compatible. Like you said, there are package conflicts between the two - org.springframework.oxm
in particular. This package was brought into Spring 3 from Spring-WS, and the two will clash.
Work was supposed to be completed on Spring-WS 2.0 immediately after Spring 3.0 was released, but this hasn't happened. Until that happens, Spring-WS remains incompatible with the current release of Spring Framework.
In practise, I've found that if you omit the org.springframework.oxm
JAR from the Spring 3 distro, the two work fine together. If you're using maven, though, I'm not sure if this is an option for you.
回答2:
In addition to skaffman's answer, here's how to use Spring-WS 1.5.9 with Spring 3 through Maven:
1) First exclude the OXM dependency of Spring 3. Just remove the following dependency from your POM.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
If you're using another framework that has a transitive dependency on Spring 3 (like Apache Camel's camel-spring module) use:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</exclusion>
</exclusions>
</dependency>
2) Remove the transitive dependency that Spring-WS 1.5.9 has on Spring 2.5.6:
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>1.5.9</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-support</artifactId>
<version>1.5.9</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</exclusion>
</exclusions>
</dependency>
3) Finally make sure you include the necessary Spring 3 modules (the list above) as dependencies in your POM.
That's it you should now be able to use Spring-WS 1.5.9 with Spring 3.x.
来源:https://stackoverflow.com/questions/3313314/can-spring-ws-1-5-be-used-with-spring-3