2020-03-28 18:24:37 \[main\] ERROR DruidDataSource:52 - testWhileIdle is true, validationQuery not set
![20200328182537467.png][]![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzY0OTk5Nw_size_16_color_FFFFFF_t_70]项目使用的是ssm框架
解决:在**applicationContext.xml** 文件,即配置数据库连接池相关的文件,如下图![在这里插入图片描述][20200328182901976.png]
添加以下信息(主要是最后四个property ):
## 如果是properties文件配置数据库连接: ##
例如:
driverClassName = com.mysql.cj.jdbc.Driver
url = jdbc:mysql:///test?serverTimezone=UTC
username = root
password = root
添加如下:
filters=stat
initialSize=2
maxActive=300
maxWait=60000
timeBetweenEvictionRunsMillis=60000
minEvictableIdleTimeMillis=300000
validationQuery=SELECT 1
testWhileIdle=true
testOnBorrow=false
testOnReturn=false
poolPreparedStatements=false
maxPoolPreparedStatementPerConnectionSize=200
[20200328182537467.png]: /images/1611456691369.png
[watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzY0OTk5Nw_size_16_color_FFFFFF_t_70]: /images/1611456680376.png
[20200328182901976.png]: /images/1611456665392.png