How to manage database connection pool in spring jpa?
<p>I am using spring-boot in my web application and use spring-jpa to read/write from/to my database. It works very well but I want to understand how to manage the database connections. Below is my properties configuration for database:</p>

<pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/test?characterEncoding=utf8
spring.datasource.username=user
spring.datasource.password=pwd
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.max-active=500
</code></pre>

<p>I have set the maximum connections to 500. When a user makes a request on my spring application, a database connection will be opened for him. After finishing the request, will spring jpa close this connection? If not, when will it close the unused connections?</p>

<p>I have read through the spring jpa reference document from <a href="http://docs.spring.io/spring-data/jpa/docs/current/reference/html/" rel="noreferrer">http://docs.spring.io/spring-data/jpa/docs/current/reference/html/</a>. But it doesn't mention anything about the connections. </p>