Prevent MySQL connection from getting killed
After long periods of inactivity, the MySQL server will kill the connection [1]. The newly added configuration properties perform a validation query once per minute while idle to avoid the connection from being killed. [1] https://blog.netgloo.com/2015/07/09/spring-boot-communications-link-failure-with-mysql-and-hibernate/
This commit is contained in:
parent
2215694ef6
commit
16e2a6a895
1 changed files with 3 additions and 0 deletions
|
@ -6,3 +6,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
spring.profiles.active=prod
|
spring.profiles.active=prod
|
||||||
spring.session.store-type=jdbc
|
spring.session.store-type=jdbc
|
||||||
spring.session.jdbc.initialize-schema=always
|
spring.session.jdbc.initialize-schema=always
|
||||||
|
spring.datasource.testWhileIdle=true
|
||||||
|
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||||
|
spring.datasource.validationQuery=SELECT 1
|
||||||
|
|
Loading…
Reference in a new issue