When launching an application using Spring Boot Data JPA, which connection pool scheme will be applied if both custom and standard Connection Pools are implemented in the project?
sobes.tech AI
Answer from AI
When starting a Spring Boot application with Data JPA, if both a custom connection pool and a standard pool (such as HikariCP, which is used by default) are defined in the project, Spring Boot will apply the pool that is explicitly configured and available in the context.
If you have explicitly configured your own DataSource with a connection pool and registered it as a bean, Spring Boot will use that one, ignoring the standard.
If the custom pool is not registered as a bean or not fully configured, Spring Boot will automatically create and apply the standard pool (usually HikariCP).
Thus, in case of conflict, the explicit configuration registered in the Spring context takes precedence. This allows flexible management of the connection pool, choosing the most suitable one for the project.
To check, you can verify the settings in application.properties or application.yml and ensure that the DataSource bean is correctly defined.