@Bean
public RestTemplate restTemplate() {
final HttpHost host = new HttpHost("localhost", 8080, "http");
final CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider()).useSystemProperties().build();
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryDigestAuth(host, client);
final RestTemplate restTemplate = new RestTemplate(requestFactory);
final int timeout = 5;
configureTimeouts(requestFactory, timeout);