Spring AI has not yet confirmed a formal deprecation or removal date for ChatMemory. Its 2.1 upgrade notes say the community spring-ai-session project is planned to replace it, while the 2.1.0-M1 reference still documents ChatMemory and labels that documentation unstable. If you are planning a migration, treat Session as a documented successor—not yet as a confirmed, drop-in replacement.
What replaces ChatMemory in Spring AI 2.1?
The Spring AI upgrade notes describe spring-ai-session as a community project with session-aware memory and say it is planned to replace ChatMemory in Spring AI 2.1. That is roadmap language, not a release-specific deprecation annotation or confirmation that ChatMemory has already been removed. The official 2.1.0-M1 API reference says the documentation is still in development and not stable, and identifies Spring AI 2.0.1 as the latest stable version at the time of that reference.
As an Amazon Associate I earn from qualifying purchases.
So, the practical answer is: learn and evaluate the Session API, but do not assume you must migrate immediately or that a supported conversion path is available. The reviewed documentation does not establish a formal deprecation date, a stable official migration guide, or automatic conversion of persisted ChatMemory records.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →- Spring AI upgrade notes describe Session as planned to replace ChatMemory in 2.1.
- Spring AI Chat Memory reference continues to document
ChatMemory; its 2.1.0-M1 documentation warns that the version is in development and unstable.
How ChatMemory and Session differ
ChatMemory separates message storage from the decision about which conversation context to include. A ChatMemoryRepository stores and retrieves messages; the ChatMemory implementation can select what to retain, such as a recent message window. Spring AI distinguishes this conversational context from a complete transcript or audit record: for that, its reference recommends a separate storage approach, such as Spring Data.
#1 Best Overall
The community Session project describes a structured, event-sourced conversation model. Messages are represented as session events with identity, timestamp, session ownership, and metadata. It documents turn-aware compaction and a SessionRepository extension point. These are different models, not simply renamed interfaces.
| Area | ChatMemory | Session API |
|---|---|---|
| Project status | Spring AI API documented in the official reference. | Community project that Spring AI’s 2.1 upgrade notes say is planned as the replacement. |
| Memory model | Repository stores messages; memory selects relevant context. | Structured session events with identity, timestamps, ownership, and metadata. |
| History and compaction | Can retain a selected context window; the reference advises separate storage for a complete transcript. | Project documentation describes retaining event history while compacting active context. |
| Storage options | Repository implementations and configuration depend on the Spring AI version and storage integration in use. | Project overview lists in-memory and JDBC options and mentions Redis as a possible backend; the documented JDBC implementation supports PostgreSQL, MySQL, MariaDB, and H2. |
| Migration compatibility | Existing repositories may have their own schema, metadata, and identity conventions. | No automatic conversion or general persisted-data compatibility is established in the cited guides. |
The Session project lists sliding-window, turn-window, token-count, and recursive-summarization compaction strategies, with triggers based on turns or tokens. These are capabilities described by the community documentation, not a guarantee that a given strategy will preserve the behavior of your current application.
For the project’s model and integrations, see the spring-ai-session project and its README.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #2
Check compatibility before adding the Session starter
The community quickstart currently states a baseline of Java 17+, Spring AI 2.0.1+, and Spring Boot 4.1.1+. These are the guide’s stated requirements; confirm them against the exact Session artifact version and dependency set you intend to use. A baseline listed in a project guide is not proof that every combination of framework versions has been tested for your application.
The documented JDBC starter coordinate is:
org.springaicommunity:spring-ai-starter-session-jdbc
Choose JDBC only if its supported database and operational characteristics fit your deployment. The project overview also mentions in-memory storage and Redis as a possible backend; verify the implementation and compatibility details for the release you select rather than assuming all backends have the same support status.
Pass a session ID to SessionMemoryAdvisor
The community quickstart builds a SessionMemoryAdvisor with a SessionService, then supplies the session ID as a per-call advisor parameter. In this pattern, the advisor loads prior context, appends messages, and can compact history when configured triggers fire.
Rank #3
SessionMemoryAdvisor advisor = SessionMemoryAdvisor.builder(sessionService)
.compactionTrigger(new TurnCountTrigger(20))
.compactionStrategy(
SlidingWindowCompactionStrategy.builder().maxEvents(10).build())
.build();
ChatClient chatClient = ChatClient.builder(chatModel)
.defaultAdvisors(advisor)
.build();
String answer = chatClient.prompt()
.user("What is Spring AI?")
.advisors(a -> a.param(
SessionMemoryAdvisor.SESSION_ID_CONTEXT_KEY, "session-abc"))
.call()
.content();
This is the community guide’s integration shape, not a verified conversion of an existing application. The trigger and window values are example configuration, not universal recommendations. Choose compaction behavior based on the context your application needs and validate it with representative conversations.
Map conversation identity deliberately
Current Spring AI memory advisors require ChatMemory.CONVERSATION_ID; the official API reference says omitting it results in an IllegalArgumentException. Spring AI 2.0 upgrade notes also record removal of ChatMemory.DEFAULT_CONVERSATION_ID, directing applications to supply an explicit conversation ID or derive one from session or user context.
The Session guide uses SessionMemoryAdvisor.SESSION_ID_CONTEXT_KEY. Do not mechanically treat a ChatMemory conversation ID and a Session session ID as interchangeable. Decide how the identifier maps to your authenticated user, conversation lifecycle, and access-control rules. If you use Session recall tools, the Session migration guide’s 0.9.0 guidance says conversation_search needs the session ID in tool context as well as advisor context; check the guide for the Session version you actually deploy.
Rank #4
Plan the migration around behavior and stored data
Before replacing an advisor or repository, document what the current implementation actually guarantees. A new API can compile while changing which messages reach the model, how tool interactions are represented, or how records are scoped.
- Repository schema: Identify the tables, keys, indexes, serialization format, and retention rules used by the current
ChatMemoryRepository. - Identity and access: Trace how user identity, conversation IDs, and authorization checks constrain reads and writes. Define the intended mapping to Session IDs.
- Message semantics: Check how your application handles tool calls and tool responses, message metadata, ordering, timestamps, and incomplete turns.
- Advisor composition: Record the existing advisor order and prompt behavior. Changes to advisor hierarchy or ordering can affect the context sent to a model.
- History expectations: Separate the context needed for a model response from any complete transcript, audit, or retention requirement.
- Data conversion: Design and test any export, transformation, or dual-read strategy yourself; the cited documentation does not promise automatic conversion of existing ChatMemory rows.
- Compaction behavior: Test the selected strategy with long conversations and tool-call sequences, and check that required context remains available after compaction.
Run the Session integration alongside representative use cases before switching production traffic. Verify session isolation, tool-call behavior, expected recall, persistence after restart, and recovery from partial writes. These are application checks, not claims of a built-in migration guarantee.
Recommended Free Tools
Keep earlier Spring AI upgrade changes separate
Some memory-related changes belong to earlier Spring AI upgrades and should not be mistaken for the Session roadmap. Spring AI 1.0 upgrade notes record repository-related naming changes, including artifact names gaining a repository suffix, package paths gaining .repository., auto-configuration class names gaining Repository, and properties changing from spring.ai.chat.memory.<storage>... to spring.ai.chat.memory.repository.<storage>.... They also document removal of CassandraChatMemory, simplification of the memory advisor hierarchy, and removal of deprecated JDBC APIs.
Spring AI 2.0 notes separately record the removal of ChatMemory.DEFAULT_CONVERSATION_ID and the requirement for a conversation ID in memory advisors. They also describe removing PromptChatMemoryAdvisor in favor of MessageChatMemoryAdvisor, which supplies history as typed message objects rather than embedding it in the system prompt. Review the upgrade notes for the versions you cross; these changes are not themselves evidence that Session is already a stable replacement.
Use the official upgrade notes alongside the Chat Memory API reference to identify version-specific changes in your application.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




