Notes & guides
Blog
Posts about software, Java, Spring, and community.
$ docker compose up -d $ docker compose ps api running :8080 db healthy :5432 redis running :6379
Testing Spring Boot and JPA with Testcontainers
Testing against real PostgreSQL instead of H2: @ServiceConnection, @DataJpaTest, Flyway migrations, an N+1 regression test by counting queries, container reuse and running the app locally with containers.
$ ./mvnw spring-boot:run Tomcat started on :8080 Started Application
RAG with Spring AI and PostgreSQL pgvector
An app that answers questions over your own documents: generating embeddings with Spring AI, storing them in pgvector, similarity search, and enriching the prompt with QuestionAnswerAdvisor.
$ ./mvnw spring-boot:run Tomcat started on :8080 Started Application
Tool Calling and MCP with Spring AI
Exposing your application's functions to an LLM with Spring AI — tool calling with @Tool, ToolContext, returnDirect, security, and setting up a Model Context Protocol (MCP) server and client.
$ ./mvnw spring-boot:run Tomcat started on :8080 Started Application
Getting Started with Spring AI: ChatClient, Prompts, Structured Output and Chat Memory
Adding LLM support to a Spring Boot app with Spring AI — setup, the ChatClient API, prompt templates, structured output into records, streaming and conversation memory.
$ ./mvnw spring-boot:run Tomcat started on :8080 Started Application
@Transactional Pitfalls and Locking with Spring and Hibernate
How @Transactional works through proxies, self-invocation, rollback rules, propagation, readOnly, optimistic and pessimistic locking, and the SKIP LOCKED job-queue pattern.
$ javac Main.java $ java Main Hello, World!
Solving the N+1 Query Problem in Hibernate and Spring Data JPA
How to detect the N+1 query problem and fix it with JOIN FETCH, @EntityGraph, @BatchSize, SUBSELECT and DTO projections — a practical guide with examples.
$ javac Main.java $ java Main Hello, World!
JPA and Hibernate Entity Mapping Best Practices
What to watch for when designing entities with Hibernate 7 and Spring Boot — ID strategies and batching, LAZY associations, bidirectional mappings, equals/hashCode, @Version, auditing and schema management.
$ ./mvnw spring-boot:run Tomcat started on :8080 Started Application
Virtual Threads in Spring Boot with Java 25
Enabling virtual threads in Spring Boot, how Java 24+ fixed the pinning problem, the connection-pool bottleneck, scoped values, structured concurrency and observability tips.
$ ./mvnw spring-boot:run Tomcat started on :8080 Started Application
Spring Boot 4 and Spring Framework 7: What's New and How to Migrate
The main changes in Spring Boot 4 and Spring Framework 7 — Jakarta EE 11, modular auto-configuration, JSpecify null-safety, API versioning, HTTP service clients, built-in resilience, Jackson 3 and the steps to migrate from 3.5.