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

Baeldung on Java

  • All
  • Testing (10)
  • Data (7)
  • Architecture (7)
  • Reactive (5)
  • Spring WebFlux (4)
  • Spring Data (4)
  • Persistence (4)
  • Spring Boot (3)
  • Spring (3)
  • Maven (3)
  • Java Streams (3)
  • Java Concurrency (3)
  • Docker (3)
  • Java (2)
  • Web Services (1)
  • Spring Web (1)
  • Spring AI (1)
  • Java Dates (1)
  • Java Collections (1)
  • Jackson (1)
  • JSON (1)
  • DevOps (1)
  • Core Java (1)
  • Artificial Intelligence (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 →

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 →

Micrometer Observation and Spring Kafka

Explore the monitoring capabilities provided by Spring Kafka using Micrometer and Spring Boot Actuator. Take a look at the native metrics exposed by Apache Kafka for both producers and consumers, which offer valuable insights into performance, throughput, errors, and latency and those augmented by Spring.

Read More →

Mocking JDBC for Unit Testing

Testing code that uses JDBC objects to interact with the database raises important questions about mocking. It’s tempting to use Mockito to stub all the java.sql objects involved in acquiring a JDBC Connection, creating a Statement, executing a query and retrieving the data from the ResultSet. This comes with its own set of problems, though.

Read More →

Baeldung on Kotlin

  • All
  • Testing (1)
  • Kotlin Strings (1)
  • Kotlin Numbers (1)
  • Kotlin Basics (1)
  • Kotlin Arrays (1)

Baeldung on SQL

  • All
  • Database Concepts (1)