休息无法解析为某种类型

时间:2014-03-19 12:47:08

标签: java rest maven gwt resty-gwt

我正在尝试用restygwt编写我的Rest接口,因此我继承了

<inherits name='org.fusesource.restygwt.RestyGWT' />

并将依赖项添加到我的pom文件中。

import java.awt.PageAttributes.MediaType;

import org.fusesource.restygwt.client.MethodCallback;
import org.fusesource.restygwt.client.RestService;

@Path("/user")
public interface UserRestService extends RestService {

    @GET
    @Path("/users")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public void getUsers(MethodCallback<List<User>> callback);
}

我的所有注释都无法解析为某种类型。是否还需要另一个图书馆或我缺少什么?

3 个答案:

答案 0 :(得分:3)

您可以使用JAX-RS 2.0注释

<dependency>
  <groupId>javax.ws.rs</groupId>
  <artifactId>javax.ws.rs-api</artifactId>
  <version>2.0</version>
</dependency>

答案 1 :(得分:1)

添加了JAX-RS依赖项,知道它可以正常工作。

    <!-- JAX-RS -->
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>jsr311-api</artifactId>
        <version>1.1</version>
        <scope>provided</scope>
    </dependency>

答案 2 :(得分:0)

您应该将这些罐子添加到您的项目中。

&#13;
&#13;
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-core</artifactId>
    <version>1.19.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-server -->
<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-server</artifactId>
    <version>2.26</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-servlet -->
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-servlet</artifactId>
    <version>1.19.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.ws.rs/jsr311-api -->
<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>jsr311-api</artifactId>
    <version>1.1.1</version>
</dependency>
<dependency>
  <groupId>javax.ws.rs</groupId>
  <artifactId>javax.ws.rs-api</artifactId>
  <version>2.0</version>
</dependency> 
&#13;
&#13;
&#13;