Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Spring-WS 1.5 be used with Spring 3?

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.

like image 849
smp7d Avatar asked Jul 22 '10 20:07

smp7d


People also ask

What is WS in Spring?

Spring Web Services (Spring-WS) is a product of the Spring community focused on creating document-driven Web services.

What is Spring web dependency?

The spring-web dependency contains common web specific utilities for both Servlet and Portlet environments, while spring-webmvc enables the MVC support for Servlet environments. Since spring-webmvc has spring-web as a dependency, explicitly defining spring-web is not required when using spring-webmvc.

What is web spring?

The Spring Web Services project facilitates contract-first SOAP service development, provides multiple ways to create flexible web services, which can manipulate XML payloads in multiple ways. Being Spring based, Spring Web Services uses Spring Concepts like Dependency Injection and Configurations seamlessly.


2 Answers

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.

like image 164
Richard Kettelerij Avatar answered Sep 29 '22 09:09

Richard Kettelerij


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.

like image 34
skaffman Avatar answered Sep 29 '22 10:09

skaffman