解决方法:配置time-between-eviction-runs-millis和min-evictable-idle-time-millis
spring:
datasource:
url: xxx
username: xxx
password: xxx
driverClassName: xxx
tomcat:
time-between-eviction-runs-millis: 600000
min-evictable-idle-time-millis: 1800000
time-between-eviction-runs-millis:
指定空闲连接检查、废弃连接清理、空闲连接池大小调整之间的操作时间间隔
min-evictable-idle-time-millis:
指定一个空闲连接最少空闲多久后可被清除