跪拜 Guibai
← All articles
Java

Spring AI 2.0 Pins You to Boot 4: One Stable Stack Exists, and 4.0's Free Patches End December 31

By 唐悦玮 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Teams adopting Spring AI 2.0 must move the whole backend to Boot 4; staying on 3.5 means AI stays on 1.x with no new tool-loop or MCP features. The window for a clean jump is narrow, since 4.0's free patches end this month and pairing 4.2 means accepting a milestone Spring AI.

Summary

Spring AI 2.0 forces a Boot 4 baseline, and the version map has only one fully stable point: JDK 21 with Spring Boot 4.1 and Spring AI 2.0.1. Boot 4.0's OSS support ends December 31, while Boot 4.2 requires Spring AI 2.1, which is still a milestone. Spring AI's GA announcement documents Boot 4.0/4.1, and the 2.1.0-M1 baseline moved to 4.2, so pairing the newest Boot with the newest Spring AI GA is never possible.

The upgrade order decides whether the work gets done once or twice. JDK 21 moves first in its own round, then Boot jumps 3.5 to 4.1 directly without stopping at 4.0, and Spring AI moves last because it touches business code. Breaking changes stock up quickly: starter renames (web to webmvc, aop to aspectj), removal of @MockBean and @SpyBean, Undertow dropped, ChatModel no longer running the tool loop, immutable options, maxTokens default moving from 500 to 4096, and the azure-openai module deleted.

The quieter breakage is where teams get hurt. Jackson 3 flips four serialization defaults, including WRITE_ENUMS_USING_TO_STRING, which can change enum output mid-stream. ToolCallLimits in 2.0.1 caps calls at 40 per tool and 150 total per round, throwing ToolCallLimitExceededException past that. MessageWindowChatMemory now trims at the last user-message boundary. Staying on 3.5 with commercial support avoids most of this but caps AI on 1.x, so nothing new arrives.

Takeaways
— The only fully stable combination right now is JDK 21, Spring Boot 4.1, Spring AI 2.0.1.
— Spring Boot 3.5's last public patch, 3.5.16, shipped June 25, and 3.5's OSS support ended June 30.
— Boot 4.0's OSS support ends December 31; 4.1's ends July 31, 2027; 4.2's ends December 31, 2027.
— Spring AI 2.0 GA is documented for Boot 4.0/4.1; Spring AI 2.1.0-M1 moved the baseline to Boot 4.2.
— Spring AI 2.0 will not run on Boot 3, so staying on 3.5 caps AI at 1.x.
— The recommended order is JDK 21 as a standalone round, then Boot 3.5 straight to 4.1, then Spring AI 2.0.1 last.
— Boot 4 breaking changes include starter renames (web to webmvc, aop to aspectj), removal of @MockBean and @SpyBean, and removal of Undertow.
— OpenRewrite recipe org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0 automates the bulk renames but carries a Moderne source-visible license that corporate compliance may reject.
— In Spring AI 2.0, ChatModel no longer runs the tool-calling loop, ToolCallAdvisor became ToolCallingAdvisor, and options are immutable builder-only objects.
— Spring AI 2.0.1 added ToolCallLimits: 40 calls per tool and 150 total per round, throwing ToolCallLimitExceededException.
— Jackson 3 flipped four serialization defaults; WRITE_ENUMS_USING_TO_STRING can switch enum output to the toString() value, silently breaking downstream consumers.
— MessageWindowChatMemory now trims at the latest user-message boundary instead of cutting mid-conversation, so context budgets need recalculation.
Conclusions

Boot's "newest major version" and "version you can stay on" are now separate things; 4.0 arrived first but expires this month, making it a trap for anyone following tutorials.

The June 2026 release week, with Boot 4.1, Spring AI 2.0.0, and 3.5's final patch landing together, already fixed the version map; the only real choice left is which road to take.

Boot and Spring AI stay permanently offset by one minor, so a team that insists on both latest GA versions is chasing an impossible target.

The dangerous changes are the silent ones, Jackson 3 defaults, tool-call limits, and memory trimming, because they pass compile, startup, and smoke tests before breaking downstream consumers.

Keeping 3.5 with commercial support costs more than a license fee; it means forgoing Spring AI 2.x entirely, which lands hard on systems already routing real traffic through AI.

Concepts & terms
OSS support window
Each Spring Boot minor line gets roughly 13 months of free open-source patches after GA; when the window closes, fixes only ship in commercial builds.
Milestone release
A pre-GA build whose APIs can change and carries no production support; Spring AI 2.1.0-M1 is the only way to run Boot 4.2 today.
ToolCallLimits
Spring AI 2.0.1's cap on tool calls per round, 40 per tool and 150 total by default, with a policy to throw or return an error response to the model.
Jackson 3
Boot 4's JSON serializer, renamed from com.fasterxml.jackson to tools.jackson, with several serialization defaults flipped compared to Jackson 2.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗