Spring AI 1.0
When upgrading to Spring AI 1.0, refer to the Upgrade Notes to find out about newly introduced APIs, deprecated APIs, and information about breaking changes.
The io.arconia.rewrite.spring.ai.UpgradeSpringAi_1_0 recipe automates most of the changes introduced in Spring AI 1.0. You can use it to update your project from the milestone releases to the latest Spring AI 1.0.x release.
The recipe will:
-
Upgrade all
org.springframework.aidependencies to the 1.0.x release line. -
Rename Spring AI configuration properties to match the new property names.
-
Rename the model provider starters to the new
spring-ai-starter-model-<provider>scheme. This covers Anthropic, Azure OpenAI, Bedrock (and Bedrock Converse), Hugging Face, MiniMax, Mistral AI, OCI GenAI, Ollama, OpenAI, PostgresML, Stability AI, Transformers, Vertex AI (embedding and Gemini), Watsonx AI, and ZhipuAI. -
Rename the vector store starters to the new
spring-ai-starter-vector-store-<store>scheme. This covers Azure (and Azure Cosmos DB), MariaDB, Chroma, AWS OpenSearch, Neo4j, Milvus, Couchbase, Cassandra, Elasticsearch, pgvector, Typesense, Oracle, OpenSearch, SAP HANA, Pinecone, GemFire, Weaviate, MongoDB Atlas, Qdrant, and Redis. -
Rename the JDBC, Cassandra, and Neo4j chat-memory artifacts (model, autoconfigure, starter) to insert a
repositorysegment in their name (for example,spring-ai-model-chat-memory-jdbc→spring-ai-model-chat-memory-repository-jdbc). -
Rename the MCP starters (such as
spring-ai-mcp-client-spring-boot-starterandspring-ai-mcp-server-webflux-spring-boot-starter) to the newspring-ai-starter-mcp-{client,server}[-{webflux,webmvc}]scheme. -
Relocate types to their new packages, including:
-
Content,Media, andMediaContentfromorg.springframework.ai.modeltoorg.springframework.ai.content. -
KeywordMetadataEnricherandSummaryMetadataEnrichertoorg.springframework.ai.model.transformer. -
FactCheckingEvaluatorandRelevancyEvaluatortoorg.springframework.ai.chat.evaluation. -
QuestionAnswerAdvisorandVectorStoreChatMemoryAdvisorto thevectorstoreadvisor sub-package. -
RetrievalAugmentationAdvisorandPromptAssertto the neworg.springframework.ai.ragpackages. -
Chat-memory repository types (
JdbcChatMemoryRepositoryand the JDBC, Cassandra, Neo4j auto-configurations) to their newrepositorysub-packages (for example,org.springframework.ai.chat.memory.jdbc→org.springframework.ai.chat.memory.repository.jdbc).
-
-
Rename
ChatClient.tools(String…)totoolNames(…)andtools(FunctionCallback/ToolCallback/ToolCallbackProvider/List…)totoolCallbacks(…), with the same renames applied toChatClient.Builder.defaultTools(…). -
Replace the
CHAT_MEMORY_CONVERSATION_ID_KEYandCHAT_MEMORY_RETRIEVE_SIZE_KEYconstants withChatMemory.CONVERSATION_IDand the advisorTOP_Kconstant. -
Automatically add the
spring-ai-vector-store,spring-ai-rag, andspring-ai-advisors-vector-storedependencies when the corresponding APIs are in use. -
Add the missing
Mapargument to theMistralAiApi.ChatCompletionRequest.ResponseFormatconstructor.
Run the recipe
You can apply this recipe with any OpenRewrite-compatible tool. The tabs below show three of them: the Arconia CLI, the OpenRewrite Gradle plugin, and the OpenRewrite Maven plugin. See Running Recipes for a comparison of when to pick each one.
-
Arconia CLI
-
Gradle
-
Maven
arconia update spring-ai --to-version=1.0
First, create an init.gradle file in your project root with the following content.
initscript {
repositories {
maven { url "https://plugins.gradle.org/m2" }
}
dependencies {
classpath("org.openrewrite:plugin:latest.release")
}
}
rootProject {
plugins.apply(org.openrewrite.gradle.RewritePlugin)
dependencies {
rewrite("io.arconia.migrations:rewrite-spring:latest.release")
}
afterEvaluate {
if (repositories.isEmpty()) {
repositories {
mavenCentral()
}
}
}
configurations.named("rewrite") {
canBeConsumed = false
}
}
Then, run the following command.
./gradlew rewriteRun \
--init-script init.gradle \
-DactiveRecipe=io.arconia.rewrite.spring.ai.UpgradeSpringAi_1_0
You can remove the init.gradle file afterwards.
./mvnw -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=io.arconia.migrations:rewrite-spring:LATEST \
-Drewrite.activeRecipes=io.arconia.rewrite.spring.ai.UpgradeSpringAi_1_0