Articles
Articles
Free, practical articles on Java, Spring, SQL and AI for backend developers.
-
AI code editing: show a diff, let the user apply it
Let an LLM edit code safely: choose an edit format, validate the proposal, show a diff, apply it on click and reject stale changes. With a tested example.
-
GDPR data export implementation: stop missing tables
A GDPR data export goes stale with every new user table. Find the tables in PostgreSQL and add a JUnit test that fails when one has no export decision.
-
Spring Boot rate limit by IP behind Cloudflare
Rate limit by IP in Spring Boot behind Cloudflare: read CF-Connecting-IP only from trusted proxies, key IPv6 on a /64 and answer 429 with Retry-After.
-
Track LLM token usage and cost per user in your app
Track LLM token usage and cost per user: one event row per model call, a dated price table, budgets checked before the call, and three SQL queries.
-
Modular monolith vs microservices: start with modules
Why a modular monolith is the safer default than microservices, and how to enforce module boundaries in Spring Boot with Spring Modulith and ArchUnit.
-
Spring AI structured output: call an LLM from Java
Get a typed Java record from an LLM with Spring AI ChatClient and .entity(). The schema it sends, native mode, failure cases and tests on Spring AI 2.1.
-
Java equals and hashCode: what breaks in a HashMap
Why you must override hashCode when overriding equals in Java, shown with runnable HashMap and HashSet examples and the rules for writing both correctly.
-
Java Optional best practices: 7 common mistakes
Seven common Java Optional mistakes with the bad code and the fix: get(), isPresent(), orElse vs orElseGet, Optional fields and null returns.
-
Java record vs class: when to use which
A record is a final, shallowly immutable class for plain data. See what it generates, what it cannot do, and when a regular class is the better choice.
-
Java switch pattern matching: practical examples
Pattern matching for switch in Java 21 and 25: type patterns, when guards, sealed types, record patterns, null, and the compiler errors you will meet.
-
Java virtual threads: when to use them and when not
Virtual threads pay off for many tasks that block on I/O and do nothing for CPU-bound work. Pinning, pooling, ThreadLocal and Spring Boot, with measurements.
-
Java4Shell (CVE-2026-114938): check and fix your Java app
How to tell if Java4Shell affects your Java app, which JDK versions fix it, the JVM flag to use meanwhile, and three mistakes that leave you exposed.
-
JPA N+1 problem: three ways to fix it in Hibernate
What the N+1 query problem is in JPA and Hibernate, why EAGER does not fix it, and how JOIN FETCH, @EntityGraph and batch fetching compare, with SQL counts.
-
Spring Boot 4 migration: what changes from Boot 3
What breaks when you migrate Spring Boot 3 to 4: modular starters, Jackson 3, removed test annotations and renamed properties. Checked on Boot 4.2.0.
-
Spring Boot validation error response with ProblemDetail
Validate a request record with @Valid and return one RFC 9457 ProblemDetail format with field errors. Real responses from Spring Boot 4.2 and 3.5.
-
Spring @Transactional not working: 7 causes and fixes
Why Spring @Transactional is ignored or does not roll back: self-invocation, private and final methods, checked exceptions, threads. With runnable examples.