Resteasy ProxyFactory类的替代品是什么?

all*_*rog 8 java resteasy

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

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

小智 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);
Run Code Online (Sandbox Code Playgroud)

  • 这线程安全吗?在这种情况下怎么样?String url ="http:// localhost:12345"+"/ api"; MyService myService = ProxyFactory.create(MyService.class,url,clientExecutor); (3认同)