数据库表里有一百万数据结果简单的count(*)都导致这个错误,找了好久的方法解决了:
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/mall_tiny?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
username: root
password: root
# connectionProperties: connectTimeout=60000;socketTimeout=60000 #1.2.12版本配置失效
connectTimeout: 60000 #1.2.12版本需要单独配置才生效
socketTimeout: 60000 #1.2.12版本需要单独配置才生效
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
min-evictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat,wall