Search code examples
javaspringrestspring-webflowretrofit

Should I use retrofit rest client given I am already using Spring framework in my webapp


I am using Spring, Jersey to create my webapp which also interacts with other webservices. I am wondering if I should use Retrofit rest client or use Jersey client. A section of my pom looks like this:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.2.10.RELEASE</version>
</dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.2.10.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.10.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>3.2.10.RELEASE</version>
    </dependency>


    <!-- Jersey + Spring -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>

Solution

  • You can use what ever client you want. If you have service Interface from server side I would recommend to use Jersey 2.x. It can generate proxy for you so you can call a service as if it is local method.