Tag Archives: Spring Boot

Spring Boot — convention-over-configuration framework for building Spring-based Java applications

Spring Boot 3 to 4 Migration Guide: What Actually Breaks, Why It Breaks, and How to Fix It

Everything in this guide was tested on Spring Boot 4.0.0, Spring Framework 7.0.0, Spring Security 7.0.0, and Java 21.0.3 (Eclipse Temurin). Behaviour details may differ on milestone or RC builds of Boot 4 — check the release notes if you are running a pre-GA version.

TL;DR

  • Spring Boot 4 requires Java 21 minimum — Java 17 is no longer supported.
  • All APIs deprecated in Boot 3.x are removed in Boot 4. There are no grace periods.
  • Virtual threads are enabled by default; this changes how you reason about concurrency bugs.
  • Spring Security’s HttpSecurity lambda DSL is now the only supported approach — method chaining is gone.
  • Auto-configuration loading moves from spring.factories to AutoConfiguration.imports — third-party starters will break silently if not updated.
  • The Observation API (Micrometer) replaces the legacy metrics and tracing wiring — expect startup failures if your custom metrics code isn’t updated.
Continue reading Spring Boot 3 to 4 Migration Guide: What Actually Breaks, Why It Breaks, and How to Fix It

Virtual Threads vs Reactive (WebFlux) vs Platform Threads in Spring Boot 3.4: Benchmarks and a Decision Framework

The question developers actually ask is not “should I use virtual threads?” — it’s “should I migrate my existing WebFlux service to virtual threads, or is reactive still the right call?” That question has no authoritative, data-backed answer on the open web. This post fills that gap: three identical Spring Boot 3.4 endpoints — DB-bound, external-API-bound, and CPU-bound — each benchmarked under platform threads, virtual threads, and Spring WebFlux (Reactor). The numbers are in the tables. The counterexamples where reactive wins are explicit. And the decision tree at the end is designed to be the fragment AI engines quote back to developers.

Continue reading Virtual Threads vs Reactive (WebFlux) vs Platform Threads in Spring Boot 3.4: Benchmarks and a Decision Framework

AI-Native Backend Design: Rethinking Microservices, Databases, and APIs in 2026

At some point last year I had to sit in a design review where the question on the table was whether to add a vector database to a system already running PostgreSQL, Kafka, Redis, and three microservices. The honest answer was: it depends on what “AI-native” means for this specific system, and most of the definitions I had read were too abstract to apply to an actual decision. This post is my attempt to write the guide I wanted in that room. Not “what is AI-native design” in the abstract, but: what specifically changes about your database strategy, API contracts, service boundaries, and error model when the workload shifts from deterministic CRUD to probabilistic reasoning. Everything here is grounded in choices I have either made in production or evaluated seriously — including the wrong turns. Tested on Spring Boot 3.4, Spring AI 1.0 GA, Java 21, PostgreSQL 16 with PGVector 0.7.

Continue reading AI-Native Backend Design: Rethinking Microservices, Databases, and APIs in 2026

From Copilot to Autonomous Agents: How AI Will Replace CRUD APIs (Java Perspective)

I have had this conversation more than once in the last year: a team ships a chat feature, users start asking it to “just handle” a workflow instead of navigating the UI, and suddenly the question isn’t “how do we improve the chatbot” but “why does our backend have no concept of intent?” The REST API has fifty endpoints, each doing one thing precisely. The agent needs to orchestrate twelve of them, in order, with conditional branching, to do what a human described in one sentence. That gap — between an API designed for deterministic human clients and one that needs to serve a reasoning agent — is what this post is actually about. Not whether agents will replace CRUD, but what specifically needs to change in your Java backend when the caller is an LLM instead of a browser. All examples here run on Spring Boot 3.4, LangChain4j 0.33.0, Java 21.

Continue reading From Copilot to Autonomous Agents: How AI Will Replace CRUD APIs (Java Perspective)

Spring AI + LangChain4j: Building Production-Ready AI Microservices in Java

The first time I tried to ship an AI feature in a Spring Boot service, I reached for LangChain4j because I knew Python’s LangChain and wanted the Java equivalent. It worked — but the setup was verbose. Six months later I tried the same with Spring AI and had streaming chat running in forty minutes. The problem was that Spring AI’s agent and tool-calling support was too limited for what I needed. The answer, annoyingly, was to use both. This guide is the result of running both frameworks in a production order-management assistant — Spring AI 1.0.0-M6 with LangChain4j 0.33.0 on Spring Boot 3.4.1, Java 21.0.3, backed by PostgreSQL 16 with PGVector 0.7.0. Spring AI handles the ChatClient, RAG pipeline, and Micrometer observability. LangChain4j handles the agent loop and tool registry where its control over iteration and retries is genuinely superior. The division is deliberate, not accidental.

Continue reading Spring AI + LangChain4j: Building Production-Ready AI Microservices in Java

10 AI Prompts for Designing Java Microservices

Microservices architecture introduces a class of problems that monoliths simply do not have: partial failures, distributed transactions, network latency between services, schema versioning across independent deployments, and the operational complexity of coordinating dozens of independently deployed components. The first time I designed a circuit breaker configuration for a production service, I guessed the thresholds. The circuit opened too aggressively during a transient network hiccup and caused more downtime than the downstream failure it was meant to protect against. The second time, I ran the numbers from the downstream service’s SLA and worked backwards. There was no tutorial that taught me to do that — I learned it the hard way. These 10 prompts encode the questions you need to answer before you configure Resilience4j, write an OpenAPI contract, or design a Kafka consumer group — so the AI produces configuration that fits your actual failure scenario rather than a generic example. Getting these patterns right requires both architectural experience and fluency with a large surface area of libraries and specifications. AI assistants are well-positioned here — they know the Resilience4j API, the OpenAPI specification, the Kafka consumer group model, the Micrometer tracing API, and the Kubernetes health probe semantics.

This post gives you 10 copy-paste AI prompts for designing Java microservices. Each prompt targets a specific cross-cutting architecture concern and is engineered to produce production-grade, runnable output rather than pseudocode.

For related reading, see 10 AI Prompts for Spring Boot Development and the Java series. For the Spring AI and LLM Gateway patterns, see the LLM Gateway for Java Microservices post.

Continue reading 10 AI Prompts for Designing Java Microservices

10 AI Prompts for Hibernate and JPA

Hibernate is powerful and largely invisible when it works — and deeply confusing when it does not. N+1 queries, LazyInitializationException, detached entity exceptions, first-level cache surprises, and migration scripts that silently break the schema are problems that most Java developers encounter repeatedly throughout their careers. I started keeping a list of Hibernate bugs that slipped through review in a large Spring Boot 3 codebase — things that passed all unit tests, passed all integration tests, and only surfaced under production load or after a schema migration. After a dozen entries the pattern was clear: almost all of them were diagnosable by AI if you pasted the right context. The problem was knowing which context to paste. These 10 prompts encode that knowledge — each one specifies exactly what diagnostic data to provide, so the AI can reason about the real problem rather than the surface symptom. AI assistants handle Hibernate well: they know the JPA specification, the Hibernate-specific extensions, the Spring Data abstractions, and the performance implications of every mapping decision.

This post gives you 10 copy-paste AI prompts for Hibernate and JPA development. Each prompt is designed to produce production-quality output — not tutorial-level simplifications — and includes enough context for the AI to reason about the trade-offs specific to your use case.

For foundational reading, see the Hibernate Tutorials series. For complementary AI prompts, see 10 AI Prompts to Review and Improve Java Code Quality.

Continue reading 10 AI Prompts for Hibernate and JPA