title: Connection to Db dies after >4<24 in spring-boot jpa hibernate
body: <p>I have an app that uses spring-boot,jpa-hiberanate with mysql.I am getting this error log</p>
  
  <pre><code>Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 56,006,037 milliseconds ago.  The last packet sent successfully to the server was 56,006,037 milliseconds ago. is longer than the server configured value of 'wait_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.
  </code></pre>
  
  <p>Here is my application.properties</p>
  
  <pre><code># DataSource settings: set here configurations for the database connection
  spring.datasource.url = jdbc:mysql://localhost:3306/test
  spring.datasource.username = test
  spring.datasource.password = test
  spring.datasource.driverClassName = com.mysql.jdbc.Driver
  
  # Specify the DBMS
  spring.jpa.database = MYSQL
  
  # Show or not log for each sql query
  spring.jpa.show-sql = true
  
  # Hibernate settings are prefixed with spring.jpa.hibernate.*
  spring.jpa.hibernate.ddl-auto = update
  spring.jpa.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
  spring.jpa.hibernate.naming_strategy = org.hibernate.cfg.ImprovedNamingStrategy
  </code></pre>
  
  <p><strong>To solve this issue I can use</strong></p>
  
  <pre><code>spring.datasource.testOnBorrow=true
  spring.datasource.validationQuery=SELECT 1
  </code></pre>
  
  <p>But I checked that it's not <a href="http://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html" rel="noreferrer">recommended</a> .So can anyone suggest me what should I do to overcome this error</p>