There is no such solution. When a connection is requested from a connection pool, it is either checked out from the pool, or a new connection is created. The cost of this is incurred on the Thread that does the request. If you would always want to maintain 2 more connections in the pool than in use, you are simply moving the problem: when a connection is checked out and available < 2
then a Connection will be added. The cost incurred once again on the Thread requesting the connection (yes in theory this could be offloaded to a separate thread/executor, but that would complicate the pool).
A connection pool is intended to reduce the cost of creating connections, by keeping the connection available for re-use and thus 'spreading the cost', it is not intended to do away with the cost entirely.