Spring boot开发时,短时间没操作后数据库连接断开的问题

解决方法:配置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:
指定一个空闲连接最少空闲多久后可被清除

你可能感兴趣的:(框架学习,后台架构,Spring,boot)