java – 我应该使用改造休息客户端,因为我已经在我的webapp中使用了Spring框架

我使用
Spring,Jersey创建我的webapp,它也与其他web服务交互.

我想知道我是否应该使用Retrofit rest客户端或使用Jersey客户端.我的pom的一部分看起来像这样:

<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>

最佳答案 您可以使用您想要的客户端.如果您从服务器端有服务接口,我建议使用Jersey 2.x.它可以为您生成代理,因此您可以像调用本地方法一样调用服务.

点赞