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:
Billy Brawner 2019-11-06 15:52:11 -06:00
parent 2215694ef6
commit 16e2a6a895

View file

@ -6,3 +6,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.profiles.active=prod
spring.session.store-type=jdbc
spring.session.jdbc.initialize-schema=always
spring.datasource.testWhileIdle=true
spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.validationQuery=SELECT 1