Resteasy ProxyFactory类的替代品是什么

时间:2013-07-25 12:58:12

标签: java resteasy

我刚刚意识到RestEasy版本3.0.0中已将ProxyFactory类标记为已弃用。遗憾的是,弃用此类的方法无法在任何地方记录。我曾经用这种方式初始化我的服务,但新方法是什么?

protected static final String URL = "http://localhost:12345"+"/api";
protected static final MyService myService = ProxyFactory.create(MyService.class, URL); 

1 个答案:

答案 0 :(得分:12)

RESTEasy 3.0.2.Final(http://howtodoinjava.com/2013/08/03/jax-rs-2-0-resteasy-3-0-2-final-client-api-example/

ResteasyClient client = new ResteasyClientBuilder().build();

ResteasyWebTarget target = client.target(URL);

MyService myService = target.proxy(MyService .class);