The best Spring Data JpaRepository

Introduction In this article, I’m going to show you the best way to use the Spring Data JpaRepository, which, most often, is used the wrong way. The biggest issue with the default Spring Data JpaRepository is the fact that it extends the generic CrudRepository, which is not really compatible with the JPA specification.

The best way to write a Spring Data Exists Query

Introduction In this article, I’m going to show you the best way to write a Spring Data Exists Query that’s efficient from an SQL perspective. While doing consulting, I’ve encountered several options that are commonly used without developers knowing there are actually better alternatives.

Spring Boot Application Properties

Introduction In this article, I’m going to show you the best way to configure the Spring Boot Application Properties file. This is not just theoretical advice. I applied all these tips when developing RevoGain, a web application that allows you to calculate the gains you realized while trading stocks, commodities, or crypto using Revolut.

The best way to use the Spring Transactional annotation

Introduction In this article, I’m going to show you the best way to use the Spring Transactional annotation. This is one of the best practices I applied when developing RevoGain, a web application that allows you to calculate the gains you realized while trading stocks, commodities, or crypto using Revolut.

Keyset Pagination with Spring

Introduction In this article, I’m going to show you how you can use the Keyset Pagination technique with Spring or Spring Boot. While the default offset-based pagination provided by Spring Data PagingAndSortingRepository is useful in many situations, if you have a large result set that you have to iterate over, then the Keyset Pagination or Seek Method technique provides better performance.

The best way to write a custom Spring Data Repository

Introduction In this article, I’m going to show you the best way to write a custom Spring Data Repository. While the default JpaRepository methods, as well as the query methods, are very convenient in many situations, there might be times when you need custom Repository methods that can take advantage of any JPA provider-specific functionality.

The best way to log SQL statements with Spring Boot

Introduction In this article, I’m going to show you the best way to log SQL statements when using Spring Boot. Logging SQL queries is very important, as it allows you to validate the number of generated statements, the syntax of the auto-generated queries, as well as prove that JDBC batching works as expected.

Spring Boot performance monitoring

Introduction To ensure that your Spring Boot application fulfills the SLA (Service Level Agreement) requirements, you need a performance monitoring tool. In this article, I’m going to show you how you can monitor the data access layer of a Spring Boot application using Hypersistence Optimizer.

Read-write and read-only transaction routing with Spring

Introduction In this article, I’m going to explain how you can implement a read-write and read-only transaction routing mechanism using the Spring framework. This requirement is very useful since the Single-Primary Database Replication architecture not only provides fault-tolerance and better availability, but it allows us to scale read operations by adding more replica nodes.

Spring Boot performance tuning

Introduction While developing a Spring Boot application is rather easy, tuning the performance of a Spring Boot application is a more challenging task, as, not only it requires you to understand how the Spring framework works behind the scenes, but you have to know what is the best way to use the underlying data access framework, like Hibernate for instance. In a previous article, I showed you how easily to optimize the performance of the Petclinic demo application. However, by default, the Petclinic Spring Boot application uses the in-memory HSQLDB database, which… Read More