Currently I am setting the JWT token(client_credentials) in the header while creating the connection to solr in java. The token is expiring in 15 mins and need to recreate the connection changing the header.
Is there a better way to refresh the solr connection with the updated token in Java automatically ?
Header header = new BasicHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token);
List<Header> headers = new ArrayList();
headers.add(header);
httpClientBuilder.setDefaultHeaders(headers);
CloseableHttpClient httpClient = httpClientBuilder.build();