To use a JDBC driver to connect to a database directly in a Spring Boot application, we will need to add the following dependencies to the pom.xml file:
<dependencies> ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency></dependencies>
With the spring-boot-starter-jdbc module, Spring Boot will spin up an instance of javax.sql.DataSource and make it available as a bean in the Spring container. It will also configure a database connection pool. The mysql-connector-java library is the JDBC driver for MySQL database and you can see why we didn't specify <version> ...