I have a system who use spring boot. it use rest.
I try to call one of the service of this system with this code
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);
}
I posted error here