我有一个具有以下数据库池设置的Spring Boot应用程序。如果应用程序连续运行2到3天,我会出现池空错误。那么,有关于此的两个问题,
如果我想告诉Spring在达到maxActive(在我的情况下为32)时创建更多连接,那么需要添加什么设置?
poolProperties.setTestOnBorrow(true);
poolProperties.setTestOnConnect(true);
poolProperties.setTestWhileIdle(true);
poolProperties.setInitialSize(10);
poolProperties.setMinIdle(10);
poolProperties.setMaxIdle(10);
poolProperties.setMaxActive(32);
poolProperties.setMaxWait(5000); //5 secs
poolProperties.setLogValidationErrors(true);
poolProperties.setLogAbandoned(true);
poolProperties.setValidationQuery("SELECT 1");
o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions(129) - [http-nio-6061-exec-9] Timeout: Pool empty. Unable to fetch a connection in 5 seconds, none available[size:32; busy:32; idle:0; lastwait:5000]