javax.ws.rs.client.Client 和 org.apache.cxf.jaxrs.client.WebClient 有什么区别

Mad*_*ean 5 java spring client webclient jersey

我正在尝试在 Spring 中创建一个 REST webservice 调用者,但是如果我尝试添加基本身份验证,我不知道哪个是最好的解决方案,我应该使用org.apache.cxf.jaxrs.client.WebClient:

WebClient webClient = WebClient.create(String baseAddress, List<?> providers, String username, String password, String configLocation)
Run Code Online (Sandbox Code Playgroud)

或与泽西岛javax.ws.rs.client.Client:

HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("howtodoinjava", "password");
clientConfig.register( feature) ;
clientConfig.register(JacksonFeature.class);

Client client = ClientBuilder.newClient( clientConfig );
WebTarget webTarget = client.target("http://localhost:8080/JerseyDemos/rest").path("employees");
Run Code Online (Sandbox Code Playgroud)