Search code examples
springspring-bootspring-mvcloggingresttemplate

RestTemplate Connection Pooling Logs


Is there any way to find out or log the details of RestTemplate connnection pool, i want to make sure that RestTemplate is using custom connection pool configured.


Solution

  • When using custom connection pool. Like apache HttpClientConnection which i used, apache provides PoolingHttpClientConnectionManager class which comprise of several useful methods like getTotalStats(), fulfilled my logs for pool stats .

    @Autowired
    PoolingHttpClientConnectionManager poolingHttpClientConnectionManager;
    poolingHttpClientConnectionManager.getTotalStats();