I have upgraded to spring boot 3. I am trying to instantiate metric binder with pool connection manager.
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setDefaultMaxPerRoute(config.getMaxConnectionPerRoute());
connectionManager.setMaxTotal(config.getMaxConnectionPerRoute() * config.getNoOfRoutes());
CloseableHttpClient httpClient = HttpClientBuilder
.create().setConnectionManager(connectionManager)
.build();
new PoolingHttpClientConnectionManagerMetricsBinder(connectionManager, "my-pool").bindTo(registry);
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
restTemplate = new RestTemplate(requestFactory);
The previously used package
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
The upgraded package
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
This updated package is incompatible with PoolingHttpClientConnectionManagerMetricsBinder with issue: 'PoolingHttpClientConnectionManagerMetricsBinder(org.apache.http.pool.ConnPoolControl<org.apache.http.conn.routing.HttpRoute>, java.lang.String, java.lang.String...)' in 'io.micrometer.core.instrument.binder.httpcomponents.PoolingHttpClientConnectionManagerMetricsBinder' cannot be applied to '(org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager, java.lang.String)'
I tried to update to the old package
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
and resolve this, but this cause issue with HttpComponentsClientHttpRequestFactory
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
as the packages are incompatible 'HttpComponentsClientHttpRequestFactory(org.apache.hc.client5.http.classic.HttpClient)' in 'org.springframework.http.client.HttpComponentsClientHttpRequestFactory' cannot be applied to '(org.apache.http.client.HttpClient)'
Need solution to resolve this or any alternative approach.