Migrate to Spring AI 2.0
ProprietaryMigrate applications to Spring AI 2.0, from Spring AI 1.x or anything older that UpgradeSpringAi_1_1 migrates. This moves the classes Spring AI 2.0 renamed or relocated, including the MCP annotations and Spring transports that moved into Spring AI and the OpenAI SDK classes that replaced the former OpenAI client, passes options builders to ChatClient, builds MCP resources and tool results through their builders, flattens the .options configuration properties and upgrades Spring AI dependencies to 2.0. Calls to APIs that Spring AI 2.0 removed without a direct replacement, such as internalToolExecutionEnabled(..), toolNames(..) and the OpenAiApi builders, are marked with a TODO comment.
io. moderne. java. spring. ai2. UpgradeSpringAi_2_0mod run . --recipe= io. moderne. java. spring. ai2. UpgradeSpringAi_2_0Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Migrate to Spring AI 1.1
- Pass a
ChatOptions.BuildertoChatClient - Change method name
org.springframework.ai..* N(java.lang.Integer)ton - Change method name
org.springframework.ai.chat.model.ChatModel getDefaultOptions()togetOptions - Remove
streamToolCallResponses(..)from tool calling advisor builders - Create MCP resources and tool results with their builders
- Add comment to method invocations
- Add comment to method invocations
- Add comment to method invocations
- Add comment to method invocations
- Add comment to method invocations
- Add comment to method invocations
- Change type
ToolCallAdvisortoToolCallingAdvisor - Change type
PromptChatMemoryAdvisortoMessageChatMemoryAdvisor - Change type
org.springframework.ai.google.genai.GoogleGenAiEmbeddingConnectionDetailstoorg.springframework.ai.google.genai.embedding.GoogleGenAiEmbeddingConnectionDetails - Change type
org.springframework.ai.anthropic.api.AnthropicCacheOptionstoorg.springframework.ai.anthropic.AnthropicCacheOptions - Change type
org.springframework.ai.anthropic.api.AnthropicCacheStrategytoorg.springframework.ai.anthropic.AnthropicCacheStrategy - Change type
org.springframework.ai.anthropic.api.AnthropicCacheTtltoorg.springframework.ai.anthropic.AnthropicCacheTtl - Change type
org.springframework.ai.anthropic.api.utils.CacheBreakpointTrackertoorg.springframework.ai.anthropic.CacheBreakpointTracker - Change type
org.springframework.ai.anthropic.api.utils.CacheEligibilityResolvertoorg.springframework.ai.anthropic.CacheEligibilityResolver - Change type
CitationDocumenttoAnthropicCitationDocument - Change type
org.springframework.ai.openai.ImageResponseMetadatatoorg.springframework.ai.image.ImageResponseMetadata - Change type
org.springframework.ai.openai.metadata.audio.OpenAiAudioSpeechResponseMetadatatoorg.springframework.ai.openai.metadata.OpenAiAudioSpeechResponseMetadata - Change type
org.springframework.ai.openai.metadata.audio.OpenAiAudioTranscriptionResponseMetadatatoorg.springframework.ai.openai.metadata.OpenAiAudioTranscriptionResponseMetadata - Change type
OpenAiSdkChatModeltoOpenAiChatModel - Change type
OpenAiSdkChatOptionstoOpenAiChatOptions - Change type
OpenAiSdkEmbeddingModeltoOpenAiEmbeddingModel - Change type
OpenAiSdkEmbeddingOptionstoOpenAiEmbeddingOptions - Change type
OpenAiSdkImageModeltoOpenAiImageModel - Change type
OpenAiSdkImageOptionstoOpenAiImageOptions - Change type
OpenAiSdkImageGenerationMetadatatoOpenAiImageGenerationMetadata - Change type
OpenAiSdkImageResponseMetadatatoOpenAiImageResponseMetadata - Change type
OpenAiSdkSetuptoOpenAiSetup - Change type
io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvidertoorg.springframework.ai.mcp.server.webflux.transport.WebFluxSseServerTransportProvider - Change type
io.modelcontextprotocol.server.transport.WebFluxStreamableServerTransportProvidertoorg.springframework.ai.mcp.server.webflux.transport.WebFluxStreamableServerTransportProvider - Change type
io.modelcontextprotocol.server.transport.WebFluxStatelessServerTransporttoorg.springframework.ai.mcp.server.webflux.transport.WebFluxStatelessServerTransport - Change type
io.modelcontextprotocol.server.transport.WebMvcSseServerTransportProvidertoorg.springframework.ai.mcp.server.webmvc.transport.WebMvcSseServerTransportProvider - Change type
io.modelcontextprotocol.server.transport.WebMvcStreamableServerTransportProvidertoorg.springframework.ai.mcp.server.webmvc.transport.WebMvcStreamableServerTransportProvider - Change type
io.modelcontextprotocol.server.transport.WebMvcStatelessServerTransporttoorg.springframework.ai.mcp.server.webmvc.transport.WebMvcStatelessServerTransport - Change type
io.modelcontextprotocol.client.transport.WebFluxSseClientTransporttoorg.springframework.ai.mcp.client.webflux.transport.WebFluxSseClientTransport - Change type
io.modelcontextprotocol.client.transport.WebClientStreamableHttpTransporttoorg.springframework.ai.mcp.client.webflux.transport.WebClientStreamableHttpTransport - Rename package name
org.springaicommunity.mcp.annotationtoorg.springframework.ai.mcp.annotation - Rename package name
org.springaicommunity.mcp.methodtoorg.springframework.ai.mcp.annotation.method - Rename package name
org.springaicommunity.mcp.providertoorg.springframework.ai.mcp.annotation.provider - Rename package name
org.springaicommunity.mcp.contexttoorg.springframework.ai.mcp.annotation.context - Change the key of a Spring application property
- Change the key of a Spring application property
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Comment out Spring properties
- Migrate Spring AI properties to 2.0
- Migrate Spring AI dependencies to 2.0