Rahil
Rahil

Reputation: 71

Why hikariCP required with spring boot application?

We have added dependency in maven pom.xml for HikariCP with our Spring Boot application, but I am not sure about the benefit for this. We are using JdbcTemplate for the DB access.

Can anyone please share the benefit of HikariCP?

Upvotes: 4

Views: 3651

Answers (1)

Karol Dowbecki
Karol Dowbecki

Reputation: 44980

HikariCP is a JDBC connection pooling library while JdbcTemplate is a Spring Framework class used to simplify the SQL operations in your application code. You are comparing apples to oranges.

You most likely need some kind of JDBC pooling library if your application connects to a database, unless you can manage this entirely with the JDBC driver options. The JDBC pooling library is there to provide a number of functionalities:

  • Throttling the number of open connections
  • Checking for stale connections
  • Reconnecting and managing connection state

Starting from Spring Boot 2.0 HikariCP is the default solution, previously it was tomcat-jdbc. More on this change in the official Spring Boot 2.0 migration guide.

Upvotes: 7

Related Questions