© Marten Deinum 2018
Marten DeinumSpring Boot 2 Recipeshttps://doi.org/10.1007/978-1-4842-3963-6_7

7. Data Access

Marten Deinum1 
(1)
Meppel, Drenthe, The Netherlands
 

When working with a database the first thing you need is a connection to the database. A connection in Java is obtained through a javax.sql.DataSource. Spring provides out-of-the-box several implementations of a DataSource like the DriverManagerDataSource and SimpleDriverDataSource . However, these implementations aren’t connections pool and should be considered mainly for testing but not production use. For a live system, you want to use a proper connection pool like HikariCP.1

Tip

In the db folder there is a Dockerfile that will build a PostgreSQL2 with the database automatically ...

Get Spring Boot 2 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.