Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.org.springframework.dao.RecoverableDataAccessException:
### Error querying database Cause:com.mysql.cj.jdbc.exception.CommunicationsException:The last packet successfully received from
the server was 1,397,833 milliseconds age. The last packet sent successfully to the server was 1,397,834 milliseconds ago.is longer
than the server configured value of 'wai_timeout', You should consider either expiring and /or testing connection
validity before use in your application , increasing the server configured values for client timeouts, or using the Connector/J connection
property 'autoReconnect = true' to avoid this problem.
使用框架 springboot +mybatis + springcloud
解决办法:
配置文件 application.properties
spring.datasource.druid.validation-query=select 1
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.max-active=100
spring.datasource.druid.initial-size=1
spring.datasource.druid.max-wait=60000
spring.datasource.druid.min-idle=1
spring.datasource.druid.time-between-eviction-runs-millis=60000
spring.datasource.druid.min-evictable-idle-time-millis=30000
spring.datasource.druid.test-while-idle=true
spring.datasource.druid.test-on-return=false
spring.datasource.druid.max-open-prepared-statements=50
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20