4

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>
Andre Perkins
  • 7,640
  • 6
  • 25
  • 39
Shiva
  • 95
  • 7

1 Answers1

2

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.

Dmytro
  • 496
  • 7
  • 17
  • @Dymtro: I think we can do the same with Retrofit as well. Are there any obvious reason to chose one over the other? Thanks. – Shiva Nov 03 '14 at 21:17
  • You said you already use Jersey for server. I consider it to be a reason to use the same framework for client as well. And if you use Jersey 2.x it will provide same convenience as Retrofit does. BTW, Jersey has test support which I like very much. – Dmytro Nov 03 '14 at 21:41