title: Connection has been already closed for Spring Boot and MySQL
body: <p>We are migrating our system from MS SQL Server to MySQL and we are using spring boot for our application. Our application facing <strong>"Connection has been already closed"</strong> SQLException for some days and we use to restart our application and it started working fine but here is the catch after some hours it start giving same connection closed SQLException.</p>
  
  <p>Here is the configs properties xfor connection:</p>
  
  <pre><code>database.jndiName=jdbc/SmartData
  database.driverClassName=com.mysql.jdbc.Driver
  database.url=XXXXXX
  database.username=XXXXXXXXXXX
  database.password=XXXXXX
  database.factory=org.apache.tomcat.jdbc.pool.DataSourceFactory
  database.initialSize=2
  database.logAbandoned=false
  database.maxIdle=4
  database.maxWaitMillis=29998
  database.minEvictableIdleTimeMillis=3000
  database.minIdle=2
  database.removeAbandonedTimeout=6
  database.removeAbandoned=true
  database.testOnBorrow=true
  database.testOnReturn=false
  database.testWhileIdle=false
  database.timeBetweenEvictionRunsMillis=3000
  database.validationQuery=SELECT 2+2
  database.maxActive=10
  database.validationInterval=3000
  </code></pre>