小编Mic*_*ley的帖子

使用JerseyTest 2.0时未注入@Context WebConfig

我有一个简单的资源,如:

@Path("/")
public class RootResource {
    @Context WebConfig wc;

    @PostConstruct 
    public void init() {
        assertNotNull(wc);
    }

    @GET
    public void String method() {
        return "Hello\n";
    }
}
Run Code Online (Sandbox Code Playgroud)

我试图使用JerseyTest(2.x,而不是1.x)和GrizzlyTestContainerFactory.

我无法解决在配置方面我需要做什么以获取注入的WebConfig对象.

integration-testing jersey-2.0

1
推荐指数
1
解决办法
1613
查看次数

标签 统计

integration-testing ×1

jersey-2.0 ×1