Add ai-21-migration module: upgrading Spring AI 2.0.x to 2.1.0, measured. One probe source tree run on 2.0.0, 2.0.2, 2.0.3 and 2.1.0 (Anthropic prompt tokens with caching, auth header, discarded temperature, thinking parts, message mutability, entity() on refusals), three compile breaks, API and configuration diffs from the jars, ChatMemory to session copy, a wrapping ToolCallingManager under tool confirmation, the OpenAI Responses switch, VectorStore.upsert on real pgvector, a grep checklist and an OpenRewrite recipe. Scripted and local fake models; no provider called. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
This commit is contained in:
Claude
2026-12-03 09:46:46 +05:30
parent 8f69e7bf50
commit c8fa0912f7
71 changed files with 1990 additions and 0 deletions
@@ -0,0 +1,6 @@
# Anthropic usage with cache tokens (Spring AI 2.0.0)
server reports: input_tokens=50 cache_creation=300 cache_read=2000 output=100
call() promptTokens=50 completionTokens=100 totalTokens=150 cacheRead=2000 cacheWrite=300
call() prompt + cacheRead + cacheWrite (the old workaround) = 2350
stream() promptTokens=50 completionTokens=100 totalTokens=150 cacheRead=null cacheWrite=null
stream() prompt + cacheRead + cacheWrite (the old workaround) = 50
@@ -0,0 +1,6 @@
# Anthropic usage with cache tokens (Spring AI 2.0.2)
server reports: input_tokens=50 cache_creation=300 cache_read=2000 output=100
call() promptTokens=50 completionTokens=100 totalTokens=150 cacheRead=2000 cacheWrite=300
call() prompt + cacheRead + cacheWrite (the old workaround) = 2350
stream() promptTokens=50 completionTokens=100 totalTokens=150 cacheRead=null cacheWrite=null
stream() prompt + cacheRead + cacheWrite (the old workaround) = 50
@@ -0,0 +1,6 @@
# Anthropic usage with cache tokens (Spring AI 2.0.3)
server reports: input_tokens=50 cache_creation=300 cache_read=2000 output=100
call() promptTokens=2350 completionTokens=100 totalTokens=2450 cacheRead=2000 cacheWrite=300
call() prompt + cacheRead + cacheWrite (the old workaround) = 4650
stream() promptTokens=2350 completionTokens=100 totalTokens=2450 cacheRead=2000 cacheWrite=300
stream() prompt + cacheRead + cacheWrite (the old workaround) = 4650
@@ -0,0 +1,6 @@
# Anthropic usage with cache tokens (Spring AI 2.1.0)
server reports: input_tokens=50 cache_creation=300 cache_read=2000 output=100
call() promptTokens=2350 completionTokens=100 totalTokens=2450 cacheRead=2000 cacheWrite=300
call() prompt + cacheRead + cacheWrite (the old workaround) = 4650
stream() promptTokens=2350 completionTokens=100 totalTokens=2450 cacheRead=2000 cacheWrite=300
stream() prompt + cacheRead + cacheWrite (the old workaround) = 4650
@@ -0,0 +1,5 @@
# What AnthropicChatModel sends, temperature=0.2 set (Spring AI 2.0.0)
header no Authorization header
header x-api-key: <key>
header anthropic-version: 2023-06-01
body "temperature":0.2
@@ -0,0 +1,5 @@
# What AnthropicChatModel sends, temperature=0.2 set (Spring AI 2.0.2)
header no Authorization header
header x-api-key: <key>
header anthropic-version: 2023-06-01
body "temperature":0.2
@@ -0,0 +1,5 @@
# What AnthropicChatModel sends, temperature=0.2 set (Spring AI 2.0.3)
header no Authorization header
header x-api-key: <key>
header anthropic-version: 2023-06-01
body "temperature":0.2
@@ -0,0 +1,7 @@
# What AnthropicChatModel sends, temperature=0.2 set (Spring AI 2.1.0)
header Authorization: Bearer <key>
header no x-api-key header
header anthropic-version: 2026-10-21
body no temperature field
WARN org.springframework.ai.anthropic.AnthropicChatModel -- Anthropic API 2026-10-21 does not support temperature, topP or topK; ignoring temperature=0.2, topP=null, topK=null
WARN org.springframework.ai.anthropic.AnthropicChatModel -- Anthropic API 2026-10-21 does not support temperature, topP or topK; ignoring temperature=0.2, topP=null, topK=null
@@ -0,0 +1,5 @@
# A reply with one thinking block and one text block (Spring AI 2.0.0)
getResults().size() = 2
getResult().getOutput().getText() = The user greets me.
generation 0: text=The user greets me. metadata keys=[messageType, signature]
generation 1: text=Hello there. metadata keys=[messageType]
@@ -0,0 +1,5 @@
# A reply with one thinking block and one text block (Spring AI 2.0.2)
getResults().size() = 2
getResult().getOutput().getText() = Hello there.
generation 0: text=Hello there. metadata keys=[anthropicThinkingContents, messageType]
generation 1: text=The user greets me. metadata keys=[messageType, signature]
@@ -0,0 +1,5 @@
# A reply with one thinking block and one text block (Spring AI 2.0.3)
getResults().size() = 2
getResult().getOutput().getText() = Hello there.
generation 0: text=Hello there. metadata keys=[anthropicThinkingContents, messageType]
generation 1: text=The user greets me. metadata keys=[messageType, signature]
@@ -0,0 +1,4 @@
# A reply with one thinking block and one text block (Spring AI 2.1.0)
getResults().size() = 1
getResult().getOutput().getText() = Hello there.
generation 0: text=Hello there. metadata keys=[messageType]
@@ -0,0 +1,4 @@
# Message mutability and equality (Spring AI 2.0.0)
userMessage.getMedia().add(..) returns true
assistant.getToolCalls().clear() throws UnsupportedOperationException
same text, different image: equals() = true
@@ -0,0 +1,4 @@
# Message mutability and equality (Spring AI 2.0.2)
userMessage.getMedia().add(..) returns true
assistant.getToolCalls().clear() throws UnsupportedOperationException
same text, different image: equals() = true
@@ -0,0 +1,4 @@
# Message mutability and equality (Spring AI 2.0.3)
userMessage.getMedia().add(..) returns true
assistant.getToolCalls().clear() throws UnsupportedOperationException
same text, different image: equals() = true
@@ -0,0 +1,4 @@
# Message mutability and equality (Spring AI 2.1.0)
userMessage.getMedia().add(..) throws UnsupportedOperationException
assistant.getToolCalls().clear() throws UnsupportedOperationException
same text, different image: equals() = false
@@ -0,0 +1,8 @@
# entity() on a filtered reply and on a SafeGuardAdvisor refusal (Spring AI 2.0.0)
finishReason=content_filter, empty text
entity(Answer.class) throws MismatchedInputException
responseEntity(..).entity() throws MismatchedInputException
content() returns ''
SafeGuardAdvisor blocks the word 'password'
entity(Answer.class) throws StreamReadException
finishReason returns 'null'
@@ -0,0 +1,8 @@
# entity() on a filtered reply and on a SafeGuardAdvisor refusal (Spring AI 2.0.2)
finishReason=content_filter, empty text
entity(Answer.class) throws MismatchedInputException
responseEntity(..).entity() throws MismatchedInputException
content() returns ''
SafeGuardAdvisor blocks the word 'password'
entity(Answer.class) throws StreamReadException
finishReason returns 'null'
@@ -0,0 +1,8 @@
# entity() on a filtered reply and on a SafeGuardAdvisor refusal (Spring AI 2.0.3)
finishReason=content_filter, empty text
entity(Answer.class) throws MismatchedInputException
responseEntity(..).entity() throws MismatchedInputException
content() returns ''
SafeGuardAdvisor blocks the word 'password'
entity(Answer.class) throws StreamReadException
finishReason returns 'null'
@@ -0,0 +1,8 @@
# entity() on a filtered reply and on a SafeGuardAdvisor refusal (Spring AI 2.1.0)
finishReason=content_filter, empty text
entity(Answer.class) throws ContentFilteredException
responseEntity(..).entity() returns null
content() returns ''
SafeGuardAdvisor blocks the word 'password'
entity(Answer.class) throws GuardrailRefusalException
finishReason returns 'guardrailRefusal'
@@ -0,0 +1,9 @@
# javac -Xlint:deprecation,removal on probes/.../LegacyAssistant.java (from the Maven build log)
Spring AI 2.0.3: 0 warnings
Spring AI 2.1.0: 6 warnings
LegacyAssistant.java:[20,9] chat.memory.ChatMemory in chat.memory has been deprecated and marked for removal
LegacyAssistant.java:[21,43] chat.memory.InMemoryChatMemoryRepository in chat.memory has been deprecated and marked for removal
LegacyAssistant.java:[20,29] chat.memory.MessageWindowChatMemory in chat.memory has been deprecated and marked for removal
LegacyAssistant.java:[25,34] chat.client.advisor.MessageChatMemoryAdvisor in chat.client.advisor has been deprecated and marked for removal
LegacyAssistant.java:[32,40] chat.memory.ChatMemory in chat.memory has been deprecated and marked for removal
LegacyAssistant.java:[40,17] [removal] temperature(Double) in anthropic.AnthropicChatOptions.AbstractBuilder has been deprecated and marked for removal
@@ -0,0 +1,16 @@
# javac on broken/src/*.java against two Spring AI versions
== Spring AI 2.0.3
BedrockParams.java: compiles
DeepSeekPrefix.java: compiles
ThoughtKey.java: compiles
== Spring AI 2.1.0
BedrockParams.java: FAILS
BedrockParams.java:6: error: incompatible types: Map<String,String> cannot be converted to Map<String,Object>
DeepSeekPrefix.java: FAILS
DeepSeekPrefix.java:4: error: cannot find symbol
symbol: method prefixAssistantMessage(String)
ThoughtKey.java: FAILS
ThoughtKey.java:4: error: cannot find symbol
symbol: variable THOUGHT_METADATA_KEY
@@ -0,0 +1,10 @@
# Copying a ChatMemory conversation into a session (scripted model)
added to memory: 1 system message + 4 turns, maxMessages=5
memory holds: system:Be brief. | user:question 3 | assistant:answer 3 | user:question 4 | assistant:answer 4
copied: 4 messages
copied again: 0 messages (already has events)
session holds: user:question 3 | assistant:answer 3 | user:question 4 | assistant:answer 4
appendMessage(system): IllegalArgumentException: Storing a SystemMessage in session 'c2' is disabled. System prompts are configuration: supply them on every request (e.g. ChatClient defaultSystem/.system, or your own prompt builder) and keep per-session settings in Session.metadata. To store system messages anyway, use DefaultSessionService.builder().allowSystemMessages(true) or set spring.ai.session.allow-system-messages=true. See the "System Messages" reference page.
next prompt the model sees: user:question 3 | assistant:answer 3 | user:question 4 | assistant:answer 4 | user:question 5
ChatMemory.CONVERSATION_ID = chat_memory_conversation_id
MemoryAdvisor.CONVERSATION_ID = chat_memory_conversation_id
@@ -0,0 +1,7 @@
# A custom ToolCallingManager and a tool that requires confirmation (scripted model)
manager written for 2.0 (two methods)
paused reply, awaiting [call_1], tool ran: []
resume: UnsupportedOperationException: com.ankurm.aimigration.ToolManagerTest$Old does not support tool call decisions
LoggingToolCallingManager (three methods)
paused reply, awaiting [call_1], tool ran: []
resume: ok, tool ran: [A-17]
@@ -0,0 +1,9 @@
# spring.ai.openai.chat.model=my-model and .temperature=0.1, with and without spring.ai.openai.chat.api (local fake server)
spring.ai.openai.chat.api unset
bean: OpenAiChatModel
POST /v1/chat/completions
body: model="my-model" temperature=0.1
spring.ai.openai.chat.api = responses
bean: OpenAiResponsesChatModel
POST /v1/responses
body: model="gpt-5-mini" temperature=(not sent)
+11
View File
@@ -0,0 +1,11 @@
# VectorStore.upsert on SimpleVectorStore and on PgVectorStore (pgvector/pgvector:pg17)
SimpleVectorStore.upsert: UnsupportedOperationException: SimpleVectorStore does not support upsert
PgVectorStore.upsert twice, same id
rows in vector_store: 1
embedding model calls: 0
similaritySearch(float[], request)
text: second version
embedding model calls: 0
stored metadata distance=42 reads back as: 42
getScore(): 1.0
upsert with a 2-wide vector: IllegalArgumentException: Embedding at index 0 has dimension 2 but the store expects dimension 3
+2
View File
@@ -0,0 +1,2 @@
# UncachedTokens.of on the 2.1.0 usage values
promptTokens=2350 cacheRead=2000 cacheWrite=300 -> full-price input = 50
+100
View File
@@ -0,0 +1,100 @@
# public API, Spring AI 2.0.3 -> 2.1.0 (tools/ApiDiff.java over every non-starter jar in the BOM)
REMOVED public types: 3
org.springframework.ai.bedrock.converse.BedrockReasoningContent$Builder [spring-ai-bedrock-converse]
org.springframework.ai.mcp.annotation.spring.scan.AbstractAnnotatedMethodBeanPostProcessor [spring-ai-mcp-annotations]
org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration$ServerAnnotatedMethodBeanPostProcessor [spring-ai-autoconfigure-mcp-server-common]
REMOVED public/protected members of types that still exist: 29
org.springframework.ai.chat.client.advisor.api.BaseChatMemoryAdvisor#getConversationId(Map)String
org.springframework.ai.chat.messages.AssistantMessage#equals(Object)boolean
org.springframework.ai.chat.messages.AssistantMessage#hashCode()int
org.springframework.ai.chat.messages.SystemMessage#equals(Object)boolean
org.springframework.ai.chat.messages.SystemMessage#hashCode()int
org.springframework.ai.chat.messages.ToolResponseMessage#equals(Object)boolean
org.springframework.ai.chat.messages.ToolResponseMessage#hashCode()int
org.springframework.ai.deepseek.DeepSeekAssistantMessage#prefixAssistantMessage(String)DeepSeekAssistantMessage
org.springframework.ai.deepseek.DeepSeekAssistantMessage#prefixAssistantMessage(String,String)DeepSeekAssistantMessage
org.springframework.ai.google.genai.GoogleGenAiChatModel#THOUGHT_METADATA_KEY
org.springframework.ai.mcp.client.common.autoconfigure.McpToolCallbackAutoConfiguration#mcpAsyncToolCallbacks(ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)AsyncMcpToolCallbackProvider
org.springframework.ai.mcp.client.common.autoconfigure.McpToolCallbackAutoConfiguration#mcpToolCallbacks(ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)SyncMcpToolCallbackProvider
org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration#mcpAsyncServer(McpServerTransportProviderBase,McpSchema$ServerCapabilities$Builder,McpServerProperties,McpServerChangeNotificationProperties,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider,Optional)McpAsyncServer
org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration#mcpSyncServer(McpServerTransportProviderBase,McpSchema$ServerCapabilities$Builder,McpServerProperties,McpServerChangeNotificationProperties,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider,Optional)McpSyncServer
org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration#serverAnnotatedMethodBeanPostProcessor(McpServerAnnotationScannerAutoConfiguration$ServerMcpAnnotatedBeans,McpServerAnnotationScannerProperties)McpServerAnnotationScannerAutoConfiguration$ServerAnnotatedMethodBeanPostProcessor
org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration$ServerMcpAnnotatedBeans#<init>()void
org.springframework.ai.mcp.server.webflux.autoconfigure.McpServerSseWebFluxAutoConfiguration#webFluxTransport(JsonMapper,McpServerSseProperties)WebFluxSseServerTransportProvider
org.springframework.ai.mcp.server.webflux.autoconfigure.McpServerStatelessWebFluxAutoConfiguration#webFluxStatelessServerTransport(JsonMapper,McpServerStreamableHttpProperties)WebFluxStatelessServerTransport
org.springframework.ai.mcp.server.webflux.autoconfigure.McpServerStreamableHttpWebFluxAutoConfiguration#webFluxStreamableServerTransportProvider(JsonMapper,McpServerStreamableHttpProperties)WebFluxStreamableServerTransportProvider
org.springframework.ai.mcp.server.webmvc.autoconfigure.McpServerSseWebMvcAutoConfiguration#webMvcSseServerTransportProvider(JsonMapper,McpServerSseProperties)WebMvcSseServerTransportProvider
org.springframework.ai.mcp.server.webmvc.autoconfigure.McpServerStatelessWebMvcAutoConfiguration#webMvcStatelessServerTransport(JsonMapper,McpServerStreamableHttpProperties)WebMvcStatelessServerTransport
org.springframework.ai.mcp.server.webmvc.autoconfigure.McpServerStreamableHttpWebMvcAutoConfiguration#webMvcStreamableServerTransportProvider(JsonMapper,McpServerStreamableHttpProperties)WebMvcStreamableServerTransportProvider
org.springframework.ai.model.openai.autoconfigure.OpenAiAudioSpeechAutoConfiguration#openAiSdkAudioSpeechModel(OpenAiCommonProperties,OpenAiAudioSpeechProperties,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)OpenAiAudioSpeechModel
org.springframework.ai.model.openai.autoconfigure.OpenAiAudioTranscriptionAutoConfiguration#openAiSdkAudioTranscriptionModel(OpenAiCommonProperties,OpenAiAudioTranscriptionProperties,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)OpenAiAudioTranscriptionModel
org.springframework.ai.model.openai.autoconfigure.OpenAiChatAutoConfiguration#openAiChatModel(OpenAiCommonProperties,OpenAiChatProperties,ToolCallingManager,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)OpenAiChatModel
org.springframework.ai.model.openai.autoconfigure.OpenAiEmbeddingAutoConfiguration#openAiEmbeddingModel(OpenAiCommonProperties,OpenAiEmbeddingProperties,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)OpenAiEmbeddingModel
org.springframework.ai.model.openai.autoconfigure.OpenAiImageAutoConfiguration#openAiImageModel(OpenAiCommonProperties,OpenAiImageProperties,ObjectProvider,ObjectProvider,ObjectProvider,ObjectProvider)OpenAiImageModel
org.springframework.ai.model.openai.autoconfigure.OpenAiModerationAutoConfiguration#openAiSdkModerationModel(OpenAiCommonProperties,OpenAiModerationProperties,ObjectProvider,ObjectProvider,ObjectProvider)OpenAiModerationModel
org.springframework.ai.openai.metadata.OpenAiAudioTranscriptionResponseMetadata#getUsage()Object
NEWLY @Deprecated (types and members that existed before): 62
org.springframework.ai.anthropic.AnthropicChatModel#THINKING_METADATA_KEY @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.anthropic.AnthropicChatModel#THINKING_TEXT_METADATA_KEY @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.anthropic.AnthropicChatOptions#getTemperature()Double @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.anthropic.AnthropicChatOptions#getTopK()Integer @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.anthropic.AnthropicChatOptions#getTopP()Double @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.ChatMemory @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.ChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.InMemoryChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.MessageWindowChatMemory @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.cassandra.CassandraChatMemoryRepositoryConfig @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.cassandra.SchemaUtil @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.H2ChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.HsqldbChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.MysqlChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.OracleChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.PostgresChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.SqlServerChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.jdbc.SqliteChatMemoryRepositoryDialect @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.mongo.Conversation @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.mongo.MongoChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.neo4j.MediaAttributes @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.neo4j.MessageAttributes @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.neo4j.Neo4jChatMemoryRepositoryConfig @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.neo4j.ToolCallAttributes @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.neo4j.ToolResponseAttributes @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.redis.AdvancedRedisChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.redis.RedisChatMemoryConfig @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.memory.repository.redis.RedisChatMemoryRepository @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.messages.AbstractMessage#textContent @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.messages.AssistantMessage#media @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.messages.ToolResponseMessage#responses @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.chat.messages.UserMessage#media @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.deepseek.DeepSeekAssistantMessage @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.deepseek.api.DeepSeekApi#chatCompletionStream(DeepSeekApi$ChatCompletionRequest,HttpHeaders)Flux @Deprecated(forRemoval=true, since=2.1.0)
org.springframework.ai.mcp.customizer.McpAsyncServerCustomizer @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.mcp.customizer.McpStatelessAsyncServerCustomizer @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.mcp.customizer.McpStatelessSyncServerCustomizer @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.mcp.customizer.McpSyncServerCustomizer @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.mistralai.MistralAiChatModel#THINKING_CONTENT_METADATA @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatProperties#getTemperature()Double @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatProperties#getTopK()Integer @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatProperties#getTopP()Double @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatProperties#setTemperature(Double)void @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatProperties#setTopK(Integer)void @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.anthropic.autoconfigure.AnthropicChatProperties#setTopP(Double)void @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.autoconfigure.ChatMemoryAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.cassandra.autoconfigure.CassandraChatMemoryRepositoryAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.cassandra.autoconfigure.CassandraChatMemoryRepositoryProperties @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.jdbc.autoconfigure.JdbcChatMemoryRepositoryAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.jdbc.autoconfigure.JdbcChatMemoryRepositoryProperties @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.mongo.autoconfigure.MongoChatMemoryAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.mongo.autoconfigure.MongoChatMemoryIndexCreatorAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.mongo.autoconfigure.MongoChatMemoryProperties @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.neo4j.autoconfigure.Neo4jChatMemoryRepositoryAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.neo4j.autoconfigure.Neo4jChatMemoryRepositoryProperties @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.redis.autoconfigure.RedisChatMemoryRepositoryAutoConfiguration @Deprecated(since=2.1.0, forRemoval=true)
org.springframework.ai.model.chat.memory.repository.redis.autoconfigure.RedisChatMemoryRepositoryProperties @Deprecated(since=2.1.0, forRemoval=true)
+49
View File
@@ -0,0 +1,49 @@
# configuration metadata, Spring AI 2.0.3 -> 2.1.0
properties: old=957 new=1084
REMOVED: 0
NEWLY DEPRECATED: 20
spring.ai.anthropic.chat.temperature
spring.ai.anthropic.chat.top-k
spring.ai.anthropic.chat.top-p
spring.ai.chat.memory.repository.cassandra.initialize-schema
spring.ai.chat.memory.repository.cassandra.keyspace
spring.ai.chat.memory.repository.cassandra.messages-column
spring.ai.chat.memory.repository.cassandra.table
spring.ai.chat.memory.repository.cassandra.time-to-live
spring.ai.chat.memory.repository.jdbc.continue-on-error -> spring.ai.session.repository.jdbc.continue-on-error
spring.ai.chat.memory.repository.jdbc.initialize-schema -> spring.ai.session.repository.jdbc.initialize-schema
spring.ai.chat.memory.repository.jdbc.platform -> spring.ai.session.repository.jdbc.platform
spring.ai.chat.memory.repository.jdbc.schema -> spring.ai.session.repository.jdbc.schema
spring.ai.chat.memory.repository.mongo.create-indices
spring.ai.chat.memory.repository.mongo.ttl
spring.ai.chat.memory.repository.neo4j.media-label
spring.ai.chat.memory.repository.neo4j.message-label
spring.ai.chat.memory.repository.neo4j.metadata-label
spring.ai.chat.memory.repository.neo4j.session-label
spring.ai.chat.memory.repository.neo4j.tool-call-label
spring.ai.chat.memory.repository.neo4j.tool-response-label
ADDED: 127, by prefix
spring.ai.chat.client 2
spring.ai.google.genai 25
spring.ai.mcp.client 2
spring.ai.mcp.server 13
spring.ai.ollama.decision 1
spring.ai.ollama.init 2
spring.ai.openai.chat 1
spring.ai.openai.decision 16
spring.ai.openai.responses 42
spring.ai.session.allow-system-messages 1
spring.ai.session.repository 5
spring.ai.session.time-to-live 1
spring.ai.systemone.api-key 1
spring.ai.systemone.base-url 1
spring.ai.systemone.decision 2
spring.ai.systemone.retry 4
spring.ai.systemone.timeout 1
spring.ai.tools.confirmation 2
spring.ai.vectorstore.pgvector 3
spring.ai.vectorstore.qdrant 1
spring.ai.vectorstore.redis 1
+33
View File
@@ -0,0 +1,33 @@
# spring-ai-bom: managed artifacts
2.0.0: 161
2.0.3: 167
2.1.0: 181
in 2.0.3 but not 2.1.0:
new in 2.1.0 compared with 2.0.3:
spring-ai-autoconfigure-model-decision-observation
spring-ai-autoconfigure-model-session
spring-ai-autoconfigure-model-session-jdbc
spring-ai-autoconfigure-model-systemone
spring-ai-google-genai-transcription
spring-ai-google-genai-tts
spring-ai-session
spring-ai-session-advisor
spring-ai-session-jdbc
spring-ai-starter-model-google-genai-transcription
spring-ai-starter-model-google-genai-tts
spring-ai-starter-model-session-jdbc
spring-ai-starter-model-systemone
spring-ai-systemone
# versions in the root pom.xml of each release tag
property 2.0.0 2.0.3 2.1.0
spring-boot.version 4.1.0 4.1.3 4.2.0
anthropic-sdk.version 2.40.1 2.75.0 3.8.0
openai-sdk.version 4.39.1 4.101.0 4.101.0
com.google.genai.version 1.58.0 1.65.0 1.73.0
mcp.sdk.version 2.0.0 2.1.0 2.2.0
awssdk.version 2.41.22 2.55.14 2.55.14
kotlin.version 2.3.20 2.3.20 2.4.21
java.version 17 17 17
@@ -0,0 +1,33 @@
# Spring AI 2.1 upgrade checklist: legacy-app
[ ] ChatMemory API: deprecated, removed in 3.0.0 (move to sessions)
src/main/java/com/ankurm/legacy/SupportBot.java:11: public String ask(ChatClient.Builder builder, ChatMemory memory, String user, String question) {
src/main/java/com/ankurm/legacy/SupportBot.java:12: return builder.defaultAdvisors(MessageChatMemoryAdvisor.builder(memory).build())
src/main/java/com/ankurm/legacy/SupportBot.java:16: .advisors(a -> a.param(ChatMemory.CONVERSATION_ID, user))
src/main/java/com/ankurm/legacy/SupportBot.java:5:import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
src/main/java/com/ankurm/legacy/SupportBot.java:6:import org.springframework.ai.chat.memory.ChatMemory;
[ ] Chat memory modules and properties
pom.xml:47: <artifactId>spring-ai-autoconfigure-model-chat-memory-redis</artifactId>
[ ] Chat memory properties (JDBC ones have spring.ai.session replacements)
src/main/resources/application.properties:2:spring.ai.chat.memory.redis.host=localhost
src/main/resources/application.properties:3:spring.ai.chat.memory.repository.jdbc.initialize-schema=always
[ ] Anthropic sampling options: discarded with a WARN on 2.1.0
src/main/java/com/ankurm/legacy/SupportBot.java:24: .temperature(0.2)
src/main/java/com/ankurm/legacy/SupportBot.java:25: .topK(40)
[ ] Anthropic sampling properties
src/main/resources/application.properties:1:spring.ai.anthropic.chat.temperature=0.2
[ ] Token arithmetic on cache counters: prompt tokens include them since 2.0.3
src/main/java/com/ankurm/legacy/SupportBot.java:31: return usage.getPromptTokens() + usage.getCacheReadInputTokens() + usage.getCacheWriteInputTokens();
[ ] Spring AI and Spring Boot versions
pom.xml:21: <spring-ai.version>2.0.0</spring-ai.version>
pom.xml:28: <artifactId>spring-ai-bom</artifactId>
pom.xml:29: <version>${spring-ai.version}</version>
pom.xml:9: <artifactId>spring-boot-starter-parent</artifactId>
A hit is a place to read, not proof of a problem. No hit is not proof of safety.
+71
View File
@@ -0,0 +1,71 @@
# rewrite-maven-plugin 6.46.1 + rewrite-spring 6.37.1 with rewrite.yml on a copy of legacy-app
compile before (Boot 4.1.0, Spring AI 2.0.0): ok
--- before/pom.xml
+++ app/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>4.1.0</version>
+ <version>4.2.0</version>
<relativePath/>
</parent>
@@ -18,7 +18,7 @@
<properties>
<java.version>25</java.version>
- <spring-ai.version>2.0.0</spring-ai.version>
+ <spring-ai.version>2.1.0</spring-ai.version>
</properties>
<dependencyManagement>
@@ -44,7 +44,7 @@
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
- <artifactId>spring-ai-autoconfigure-model-chat-memory-redis</artifactId>
+ <artifactId>spring-ai-autoconfigure-model-chat-memory-repository-redis</artifactId>
</dependency>
</dependencies>
</project>
--- before/src/main/java/com/ankurm/legacy/SupportBot.java
+++ app/src/main/java/com/ankurm/legacy/SupportBot.java
@@ -3,6 +3,7 @@
import org.springframework.ai.anthropic.AnthropicChatOptions;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
+import org.springframework.ai.chat.client.advisor.api.MemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.metadata.Usage;
@@ -13,7 +14,7 @@
.build()
.prompt()
.user(question)
- .advisors(a -> a.param(ChatMemory.CONVERSATION_ID, user))
+ .advisors(a -> a.param(MemoryAdvisor.CONVERSATION_ID, user))
.call()
.content();
}
@@ -21,8 +22,6 @@
public AnthropicChatOptions options() {
return AnthropicChatOptions.builder()
.model("claude-sonnet-4-5")
- .temperature(0.2)
- .topK(40)
.maxTokens(1024)
.build();
}
--- before/src/main/resources/application.properties
+++ app/src/main/resources/application.properties
@@ -1,3 +1,2 @@
-spring.ai.anthropic.chat.temperature=0.2
-spring.ai.chat.memory.redis.host=localhost
+spring.ai.chat.memory.repository.redis.host=localhost
spring.ai.chat.memory.repository.jdbc.initialize-schema=always
compile after (Boot 4.2.0, Spring AI 2.1.0): ok
both recipes in one invocation, sampling calls left in SupportBot.java:
25: .temperature(0.2)
26: .topK(40)