0
我有一個系統使用春季開機。它使用休息。春季開機通話休息服務
我嘗試調用該系統的服務之一,該代碼
public static void main(String[] args) {
int timeout = 10000;
final RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout * 1000).setConnectionRequestTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build();
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(new AuthScope("localhost", 8080, AuthScope.ANY_REALM), new UsernamePasswordCredentials("bob", "smith"));
final CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).setDefaultCredentialsProvider(credentialsProvider).build();
final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(client);
RestTemplate restTemplate = new RestTemplate(requestFactory);
Map < String, String > vars = new HashMap < String, String >();
vars.put("cardId", "E004010024ABF84C");
boolean accessAllowed = restTemplate.getForObject("http://localhost:8080/rest/client/card/", Boolean.class, vars);
System.out.println(accessAllowed);
}
我這裏發佈錯誤
確定我修改了它,發佈新的錯誤。 –