跪拜 Guibai
← Back to the summary

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

Summary: To use Spring AI 2.0, Boot has to reach 4.x first. Meanwhile, 3.5's free patches stopped in June, and 4.0 has only a month left. This piece lays out three timelines precisely and then gives an upgrade order that won't cause rework.

Right now, only one combination yields all stable releases: JDK 21, Spring Boot 4.1, Spring AI 2.0.1.

Step up one more: Boot 4.2 shipped November 19, but Spring AI's matching 2.1 is still at milestone. Step down one: Boot 4.0's free patches expire December 31.

A month later you'll be doing it again.

The middle line is narrow, but it works.

Flip through Spring AI's docs and you see @McpTool on a method; at startup you get an /mcp endpoint without writing a Controller. Smooth.

Turn to the installation page. The coordinates are fine, but scroll down and the first line reads Spring Boot 4 baseline.

This isn't just adding a dependency.

The week in June when Spring settled the books

Timelines first; every judgment below rests on these rows.

Date What happened
2026-06-10 Spring Boot 4.1 GA
2026-06-12 Spring AI 2.0.0 GA; the same day, Spring AI 1.0.9 and 1.1.8 shipped too
2026-06-25 Spring Boot 3.5.16, the last public patch on the 3.5 line
2026-06-30 Spring Boot 3.5 OSS support ends
2026-11-19 Spring Boot 4.2 GA, with 4.1.3 and 4.0.10 released the same day
2026-12-31 Spring Boot 4.0 OSS support ends
2027-07-31 Spring Boot 4.1 OSS support ends
2027-12-31 Spring Boot 4.2 OSS support ends

From June 8 to 14, Spring packed its entire release train into one week. A train originally scheduled for May was moved twice, finally squeezed into this week.

4.1 landed on the 10th, two days later Spring AI 2.0.0 GA, and three days after that Spring Tools 5.2.0.

The key thing is the June 25 patch. 3.5.16 shipped, and five days later 3.5's OSS support closed.

Five days between the last patch and end of maintenance is not a coincidence, it's normal cadence. A line pushes out its accumulated fixes before closing the door.

So June is not an ordinary release month. It did three things at once: gave 4.x a stable landing point, moved the AI framework onto 4.x, and closed the door on 3.x.

Your choices are made after all three have happened.

Pick the wrong landing point and you redo a whole cycle

4.0 is the first trap, and a sneaky one.

It shipped in November 2025, six months before 4.1, and most tutorials and blog posts still run 4.0. You upgrade following them, it compiles, it starts, and the team accepts it.

Then December 31, this line's OSS support expires.

Counting from today, a one-month window. Starting January 2027, you're holding a Boot 4.0 with no free patches.

Each Boot minor gets about 13 months of OSS support, short of two years. That rule itself is fine.

The problem is it splits "newest major version" and "version you can stay on" into two different things. 4.0 is the major version that arrived first, not the one you can stay on.

The ones you can actually stay on are 4.1 and 4.2. 4.1 until the end of July 2027, 4.2 until the end of December 2027.

The interesting stretch is August through December 2027, five months. Based on the currently published release calendar, Spring hasn't scheduled a line after 4.2, and 4.1 expires at the end of July.

So during that window, 4.2 is the only line with OSS support. That's an inference, not a promise. Calendars change, but at least no next line is visible now.

On execution, the conclusion is short: jump from 3.5 straight to 4.1 now, don't stop at 4.0.

Once 4.1 is running steady, 4.2 will have been out three months, and one more upgrade is smooth. By contrast, jumping to 4.2 now stacks "major version upgrade" and "catching the first wave of new-version bugs" into a single iteration.

Urgent and steady are two different roads here, not two speeds on the same road.

The AI framework's baseline always lags Boot by one step

The second timeline is messier, because it lags on a rolling basis.

Spring AI 2.0's GA announcement says, in the original: "designed to be used with Spring Boot 4.0 / 4.1 and Spring Framework 7.0". Note it says 4.0 and 4.1, not "4.x". Framework authors are drawing a verified circle around themselves.

By Spring AI 2.1.0-M1, the baseline moved to Boot 4.2.

See it? Every time Boot advances one minor, Spring AI catches up only in the next version, and it ships as milestone first.

That means you never get "latest Boot + latest Spring AI GA". At best you get "second-newest Boot + latest Spring AI GA".

To pair Boot 4.2 with Spring AI, you have to eat 2.1's milestone.

That's not forbidden, just know what you're doing: milestone APIs change, your code changes with them, and nobody vouches for you in production.

So the choice is really:

On scheduling, the former is less work. For the rest of 2026, 4.1's OSS support still has most of the year, enough to run the AI chain under real traffic. When 2.1 goes GA, move Boot then. Two upgrades done separately, each with its own debuggable failure mode.

Upgrade two major versions at once and when something breaks you can't even tell whether it's the framework or the AI layer.

What staying on 3.5 costs

So why not just stay put?

Commercial support does exist. 3.5 is the last minor of 3.x, so it got an extension: commercial support to June 2032. Sounds like a six-year runway.

The cost is in the details. 3.5's public patches stop at 3.5.16; after that, Spring Security and Spring Framework fixes on the 3.5 line are no longer publicly released, only enterprise builds.

So you don't get the full fix list; you wait for the vendor to package. Broadcom doesn't publish pricing for this support; you negotiate.

More practical: Spring AI 2.0 won't run on Boot 3. Stay on 3.5 and the AI line caps at 1.x.

1.x isn't dead. On June 12, 1.0.9 and 1.1.8 shipped alongside the 2.0.0 GA. But 1.x gets nothing new: tool-loop externalization, the @McpTool annotation, Tool Search, all of it lives in 2.x.

That's what "keeping an escape route" really means: the road is still there, it just doesn't lead anywhere new.

For a backend taking on enterprise knowledge bases, smart approval flows, and similar scenarios, this cost isn't hard to calculate. What you're actually betting on isn't the framework version. It's whether you can use the official mainline's AI capabilities in the next two years.

Get the order wrong and you redo work

If you're going to move, order matters more than version. Same set of changes, done in the wrong sequence, is done twice.

JDK first, as its own round

Boot 4 itself only needs Java 17; the docs list compatibility through Java 27. Spring AI 2.0's M1 announcement says Java 21 required.

The two sources don't fully agree. The safe move is to start from 21. Some managed dependencies in Boot 4.1 have higher thresholds than the framework itself, e.g. jOOQ 3.20 needs 21. Start at 21 and you won't get stuck on some library.

This round changes only three things: compile source/target, CI images, launch arguments. Don't mix it with the Boot upgrade in one branch. JDK upgrade pain is runtime: GC log format, --add-opens error text, some reflection library behavior. Mixed with Boot compile errors, your debugging cost doubles.

Run a full regression, confirm clean, then open the next branch.

Jump 3.5 to 4.1, don't stop in between

Boot 4's breaking changes are concentrated at compile time, mechanical but heavy.

spring-boot-starter-web became spring-boot-starter-webmvc; spring-boot-starter-aop became -aspectj.

@MockBean and @SpyBean were removed, replaced by Spring Framework's @MockitoBean and @MockitoSpyBean.

These two new annotations can't sit in a @Configuration class. If test infrastructure declares mocks in a shared config class, you need to split it into @TestConfiguration plus @Import.

@SpringBootTest no longer auto-configures MockMvc; web-layer tests need explicit @AutoConfigureMockMvc, otherwise injection points are all null pointers.

Undertow is simply gone. Boot 4's Servlet baseline is 6.1; Undertow couldn't keep up, and the whole starter was removed. Services using it must switch to Tomcat or Jetty, and it's not a one-line config change: compression config and access-log config items all need rewriting.

The bulk can go to OpenRewrite. The recipe org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0 chains those renames into one execution, including starter replacements and @MockBean replacement.

Check the license before running. It's in rewrite-spring, under Moderne's source-visible license; corporate compliance may block it. Read the resulting diff like a colleague's PR; don't merge blindly.

There's also a transitional option: spring-boot-starter-classic and spring-boot-starter-test-classic pull every module in at once to get the build running, then clean up one by one. For big repos: get it passing first, optimize later.

Spring AI last

It touches business code, so it happens after the framework is stable.

The most fundamental change: ChatModel no longer runs the tool-calling loop.

In 1.x, each model implementation hid its own loop inside; the internalToolExecutionEnabled switch was for that. 2.0 moved the loop up to the Advisor chain, and ToolCallAdvisor was renamed ToolCallingAdvisor.

If your code relied on the model's built-in loop, now you either hand it to ChatClient or drive ToolCallingManager yourself.

Options are all immutable, builder-only creation, and copy() and fromOptions() are gone.

// 1.x: create the object, then modify properties
OpenAiChatOptions options = OpenAiChatOptions.builder().build();
options.setTemperature(0.2);   // doesn't compile in 2.0

// 2.0: everything at once
OpenAiChatOptions options = OpenAiChatOptions.builder()
        .temperature(0.2)
        .build();

Modules got cut too. spring-ai-azure-openai was deleted; Azure goes through the unified OpenAI SDK module. The Anthropic implementation was rewritten as a thin wrapper over the official Java SDK, and maxTokens default changed from 500 to 4096. That one directly changes your bill and response lengths.

One data-layer migration: the JDBC chat memory table gained a sequence_id column; old tables need it added. Empty tables don't matter; tables with history need a migration script.

MCP's annotation and transport packages both moved, and server-side tool argument validation defaults to on.

Three changes that won't error out

Those above all slap you at compile or startup. The really hard-to-find ones are these. They compile, they start, smoke tests pass, and then they quietly reshape downstream.

Jackson 3 changed defaults. Boot 4 moves from Jackson 2 to Jackson 3; package names move from com.fasterxml.jackson to tools.jackson. The annotation package didn't move, so @JsonProperty and friends still work.

The problem is default behavior. Four switches flipped:

Two flipped the other way: WRITE_DATES_AS_TIMESTAMPS and DEFAULT_VIEW_INCLUSION now default off.

Easy to miss: all Jackson exceptions became unchecked; catch blocks with JsonProcessingException need rewriting.

WRITE_ENUMS_USING_TO_STRING is the nastiest. If your enums overrode toString() for prettier logs, serialized output goes from IN_PROGRESS to Chinese. Your own service runs fine; the downstream switch branching on "IN_PROGRESS" may not hit a single branch.

Two fallbacks exist: spring.jackson.use-jackson2-defaults=true makes the auto-configured JsonMapper behave close to the 2.x defaults, or pull in spring-boot-jackson2 to keep Jackson 2.

The latter is officially deprecated and will be removed in a future version. Both are stalling, not solutions.

To actually confirm nothing changed shape, write a contract test, and it must test the mapper Spring actually configures:

@SpringBootTest
class OrderJsonContractTest {

    @Autowired
    JsonMapper mapper;   // tools.jackson.databind.json.JsonMapper

    @Test
    void orderJsonMatchesContract() throws Exception {
        var actual = mapper.writeValueAsString(sampleOrder());
        var expected = contract("order.json");
        JSONAssert.assertEquals(expected, actual, STRICT);
    }
}

Generate order.json once on the Boot 3 side before upgrading, and after the upgrade it tells you exactly which field changed shape. Write one for each external payload, not one per endpoint.

Add an ArchUnit rule to stop regression. Jackson 3 keeps annotations under the old package name, so a half-migrated codebase looks fine:

@ArchTest
static final ArchRule noJackson2Databind = noClasses()
        .should().dependOnClassesThat()
        .resideInAnyPackage("com.fasterxml.jackson.databind..",
                            "com.fasterxml.jackson.core..");

Tool calls got a hard limit. 2.0.1 introduced ToolCallLimits, default 40 calls per tool per round, 150 total across all tools; exceeding throws ToolCallLimitExceededException with finish reason toolCallLimitExceeded.

An agent doing 160 tool calls fine on 2.0.0 breaks on 2.0.1. The unit is "one round", counted from the last user message; replayed history in memory doesn't count.

The defaults are configurable, and you can choose not to throw:

spring:
  ai:
    tools:
      limits:
        max-calls-per-tool-default: 20      # per-tool per-round cap, -1 disables
        max-total-tool-calls: 60            # total across all tools
        on-limit-exceeded: RETURN_ERROR_RESPONSE   # default THROW

RETURN_ERROR_RESPONSE feeds the over-limit as an error result back to the model so it tries another path. That pattern needs a model that actually reads error messages, or it just keeps slamming the wall.

Side note: as of 2.0.1, tool resolution fallback defaults to off. A Tool Bean sits in the container, the model names it, but nothing executes. First check whether tools(...) is explicitly attached, then consider spring.ai.tools.resolution.fallback.enabled.

Default-off is intentional: a dangerous tool lying in the container shouldn't be executed just because the model happens to match its name.

Memory trimming changed its cut point. MessageWindowChatMemory now trims at the boundary of the latest user message instead of hard-cutting from the middle.

Sounds like a bug fix; it actually changes what the model sees across multi-turn conversations. Before, a Q&A round could get cut in half, leaving the model staring at orphaned tool-call records; now it doesn't, but the window holds fewer messages. Context budgets need recalculation.

In the end

Back to the original question: for the sake of an AI framework, is pushing the whole backend to Boot 4 worth it?

The answer isn't "worth it" or "not worth it"; it's how much of your code is AI. Systems that have already integrated models into the main path, enterprise knowledge bases, smart approval, smart customer service, won't get tool-loop externalization or the new MCP annotations on 1.x; dragging on is an accruing capability debt. Systems that just call a few endpoints occasionally come out ahead on paper by staying on 3.5 and buying commercial support.

If you're going to move, three combos are on the table.

Combo Versions OSS support until Who it's for
Stable JDK 21 / Boot 4.1.3 / Spring AI 2.0.1 2027-07-31 Launching this year, wants both sides stable
Long JDK 21 / Boot 4.2.0 / Spring AI 2.1.0-M1 2027-12-31 Can wait, willing to eat a milestone
Hold JDK 17 / Boot 3.5.16 / Spring AI 1.1.x Ended (commercial to 2032-06-30) Can't move, only light AI

On order, one sentence worth remembering: JDK, Boot, Spring AI, bottom to top, one layer per round. Do it backwards and you'll be editing business code on a moving foundation.

That June week already settled the version relationships for you. Your choice isn't whether to follow; it's which road you take while following.


References

Comments

Top 1 from juejin.cn, machine-translated. The original thread is authoritative.

HelloWorker

Like