Here's what I've reviewed (so far):

Baeldung on Java

  • All
  • Spring (11)
  • Java (11)
  • Testing (10)
  • Core Java (10)
  • Persistence (9)
  • Spring Boot (8)
  • JPA (8)
  • Data (8)
  • Security (7)
  • Java String (7)
  • DevOps (7)
  • Algorithms (7)
  • JSON (5)
  • Architecture (5)
  • Spring Persistence (4)
  • Reactive (4)
  • Maven (4)
  • Java IO (4)
  • IDE (4)
  • Spring Security (3)
  • Spring MVC (3)
  • Spring Cloud (3)
  • Logging (3)
  • Java Array (3)
  • Jakarta EE (3)
  • Jackson (3)
  • Web Services (2)
  • Spring Data (2)
  • REST (2)
  • Java Map (2)
  • Java Dates (2)
  • HTTP Client-Side (2)
  • Groovy (2)
  • Artificial Intelligence (2)
  • XML (1)
  • Spring AI (1)
  • NoSQL (1)
  • Java Streams (1)
  • Java List (1)
  • Java Concurrency (1)
  • Java Collections (1)
  • JVM (1)
  • Gradle (1)
  • Docker (1)
  • Cloud (1)

How to Unit Test Micrometer

Unit testing metrics is crucial for ensuring that our application correctly tracks performance data and business metrics. By using Micrometer’s SimpleMeterRegistry, we can create isolated tests that verify our metrics collection without requiring a full Spring context. When it comes to integration tests, we need to reset the MeterRegistry to perform assertions on it during our @SpringBootTests.

Read More →

Preventing Jackson From Fetching Lazy Entity Fields

Working with JPA and Jackson often raises the challenge of serializing entities that contain lazy-loaded associations. This tutorial shows how to prevent Jackson from triggering unwanted database queries when lazy fields are uninitialized; we’ll look at DTOs, annotations, and Jackson’s own jackson-datatype-hibernate6 module.

Read More →

TupleTransformer and ResultListTransformer in Hibernate

While JPQL projections solve many cases, sometimes we need more flexibility, like mapping complex DTOs, restructuring query results, or post-processing the entire result set. Hibernate’s former answer for this is ResultTransformer. Hibernate 6, however, replaces it with two new interfaces. This article shows how to work with TupleTransformer for row-level transformations and ResultListTransformer for list-level processing.

Read More →

Tagging Patterns for Micrometer Metrics

In this article, we explore Micrometer metrics with a focus on tagging. We use Micrometer in a Spring Boot application and apply various patterns to create simple metrics, such as counters and timers.

We’ll start by using Micrometer’s Builder API to create meters with variable tag values. Additionally, we’ll look at MeterProviders as an alternative that allows us to avoid potential performance issues. We’ll also use Spring AOP and Micrometer-specific annotations to record method invocations in a declarative manner.

Read More →

Implementing CQRS with Spring Modulith

Let’s take a fresh look at the CQRS pattern, exploring its benefits and trade-offs in a modular Spring Boot application. We’ll use Spring Modulith to structure our code into clearly separated modules and to enable asynchronous, event-driven communication between them.

This approach is inspired by our colleague Gaetano Piazzolla’s article, where he demonstrates CQRS with Spring Modulith in a product catalog. Here, we’ll adapt the same ideas to a movie ticket booking system and keep the two sides in sync via domain events.

Read More →