1
0
Files
spring-ai-2-migration/pom.xml
Ankur cb777068a7 Spring AI 1.x to 2.0 migration: breaking-change reference and offline verification suite
Companion code for the ankurm.com guide. Verified on Spring AI 2.0.0, Spring Boot 4.1.0,
JDK 25.0.3. run.txt is unedited mvn test output: 5 tests, 0 failures.

Runs with NO API key, no network and no provider account. A canned ChatModel returns fixed
responses; ChatClient, advisors and chat memory all sit above the model, so everything that
changed is still exercised faithfully. TestChatModel records each Prompt it receives, which
lets the tests assert what Spring AI SENT rather than what a model replied.

docs/01  complete breaking-change reference: platform (Boot 4 mandatory, Jackson 2 to 3),
         artifact renames (spring-ai-advisors-vector-store -> spring-ai-vector-store-advisor,
         spring-ai-core split, OCI and Minimax removals, MCP transports moved into Spring AI),
         options builders replacing setters, the dropped .options property prefix, tool
         calling (internalToolExecutionEnabled and toolNames removed outright, not renamed),
         chat memory, structured output schema changes, and a migration order that works.

Tested here
  - Chat memory becomes stricter: 2.0 removes the remaining default-ID and builder-based
    configuration paths (ChatMemory.DEFAULT_CONVERSATION_ID and .conversationId() are both
    gone). Explicit per-request conversation ids - introduced during the 1.x line and already
    the recommended approach - become the only migration target.
  - CONVERSATION_ID survives as the metadata KEY. It and the removed DEFAULT_CONVERSATION_ID
    look interchangeable and are opposites; swapping them to clear a compile error restores
    exactly the shared-conversation behaviour that removing it was meant to take away.
  - PromptChatMemoryAdvisor is gone; MessageChatMemoryAdvisor replaces it, and the difference
    is not cosmetic (system-prompt text vs real Message objects, so token counts change).
  - A test asserts two conversation ids cannot see each other.
2026-08-01 10:51:02 +05:30

72 lines
2.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Companion code for "Spring AI 1.x to 2.0 Migration Guide" (ankurm.com).
mvn test
Runs entirely offline. There is no API key, no network call and no model provider: a test
ChatModel returns canned responses, which is enough to exercise every API that changed.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.0</version>
<relativePath/>
</parent>
<groupId>com.ankurm.ai</groupId>
<artifactId>spring-ai-2-migration</artifactId>
<version>1.0.0</version>
<name>Spring AI 1.x to 2.0 migration</name>
<properties>
<java.version>25</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--
Spring AI is NOT managed by the Spring Boot BOM. You import its own BOM, and you are
responsible for keeping the pair compatible: Spring AI 2.0 is built on the Boot 4
dependency model and CANNOT be loaded in a Boot 3 context.
-->
<spring-ai.version>2.0.0</spring-ai.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bom</artifactId>
<version>${spring-ai.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!--
The chat client and its advisors. Note spring-ai-core is gone: it stopped at 1.0.0-M6
and the project is now split into focused modules.
-->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-client-chat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>