Spring Boot 4 + Spring AI 2.0: Count the Migration Debt Before You Touch the Version Number
Teams that treat Spring AI 2.0 as a version bump will ship silent breakage: JSON contracts change without compile errors, tool calls can execute twice or stop after the first response, and chat memory order quietly degrades. The migration is a platform-level debt project, and the difference between success and failure is contract tests, rollback paths, and token cost visibility.
Spring AI 2.0's baseline is Boot 4.0/4.1 + Spring Framework 7, and Spring's own line is that it cannot be loaded in a 3.x context. The recommended landing point is JDK 21 + Boot 4.1 + Spring AI 2.0.x, skipping Boot 4.0 and avoiding a two-major-version jump. The heavy work sits below the AI layer: javax-to-jakarta conversion can silently disable auto-configuration through stale @ConditionalOnClass checks; Jackson 3 moves packages to tools.jackson, turns exceptions unchecked, and flips six serialization defaults, including dates changing from timestamps to ISO-8601 strings. Boot 4's starter modularization removes implicit autoconfiguration, Undertow is gone, virtual threads are on by default, and @MockBean becomes @MockitoBean.
Spring AI 2.0 then rewrites the AI contract: ChatClient is the user-facing API while ChatModel drops to a building block; Options become immutable builders; tool calling moves into a ToolCallingAdvisor chain where a second advisor duplicates executions; MCP defaults switch from SSE to Streamable HTTP; provider facades are replaced by official SDKs; and Anthropic's maxTokens default jumps from 500 to 4096. JDBC ChatMemory needs a sequence_id column, and the migration path is expand, backfill, validate, switch.
The recommended route is either a four-stage monolith upgrade (JDK first, then Boot 3.5 to 4.1, then AI 1.x to 2.0) or a standalone Boot 4.1 AI gateway service that old services call over HTTP. Acceptance is behavioral equivalence: contract snapshots, tool-call roundtrip assertions, ChatMemory session tests, RAG eval sets, shadow-to-canary rollout, and rollback drills. Estimated effort for a 20-module service with AI and internal starters is 3-4 person-weeks for platform plus 1-2 for AI adaptation, with 60% of time spent verifying rather than editing code.
The dangerous failures in this migration are all silent: auto-configuration that stops loading, Jackson exceptions that never reach the old catch, JSON dates that change shape, a second tool advisor that doubles execution. Contract snapshots and /actuator/conditions diffs are the right response to that pattern.
Spring AI 2.0's visible API changes are smaller than the platform work underneath it. A team that budgets for an AI upgrade but not for Boot 4 will misestimate by weeks.
Moving tool calling into an advisor chain is a genuine improvement: guardrails like token budgets and round limits become pluggable. The new duplicate-execution footgun shows how a central abstraction can create its own failure mode.
The Anthropic maxTokens default change from 500 to 4096 is a quiet cost explosion. Provider SDK abstraction changes carry financial risk, not just compile risk.
The AI gateway route trades a risky full-platform migration for a new service with its own blast radius, which fits AI workloads' separate scaling and quota needs.