When building Spring Boot applications, it’s common to require preloading data into the database. Two approaches to achieve this are using the import.sql
and data.sql
files. In this tutorial, we’ll explore these methods and highlight their differences.
Data Access
This section will teach you how to add database access to the Spring Boot applications using the following elements:
- A running database, whether initiated by/embedded within your application or
simply accessible to your application - Database drivers enabling programmatic access, usually provided by the database vendor
- A Spring Data module for accessing the target database.
How to use JPA Native Query in Spring Boot applications
Hibernate and JPA can both execute native SQL statements against a Database. In this tutorial we will learn how to map SQL native queries in Spring Boot applications.
Hikari Connection Pool with Spring Boot made simple
HikariCP is a fast, simple, production ready JDBC connection pool. In this article we will learn how to configure it in Spring Boot applications. Then, we will cover how to monitor Hikari Connection Pool properties using Spring Boot actuator.
SpringBoot JPA example with H2 DB
ne key feature of Spring is its support for the Java Persistence API (JPA), which is a Java specification for accessing, persisting, and managing data between Java objects/classes and a database. In this tutorial, we will learn how to use JPA with Spring Boot to build robust and efficient applications.
Spring Boot JPA example with PostgreSQL
In this tutorial we will learn how to create a basic JPA Spring Boot application that uses PostgreSQL as database. We will include a REST Controller and the Thymeleaf engine so that you can test your JPA Application in both ways.
How to find slow queries in Spring Boot
This article provides some guidance on how to spot Database queries which are taking most of your time during the execution of a Spring Boot application.
Data validation in Spring Boot 2.3.0 and beyond
This short article discusses how to compile projects data using javax.validation packages for Spring Boot 2.3.0 (and newer) applications.
Solving the error Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified
This tutorial will help you to solve the error Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified in your Spring Boot applications.
Mapping DTOs in Spring Boot with MapStruct
This tutorial covers how to use MapStruct library to map automatically your Data Transfer Objects with your repository data. We will use the JPA layer of a Spring Boot application to access your data.
How to debug SQL statements in Spring Boot applications
Spring boot auto-configuration does not require a dedicated logging configuration file. So, in order to debug your SQL Statements in … Read more