/spring-boot-ai-in-memory-chat-memory

A simple Spring Boot app showing how to use Spring AI chat memory to remember messages in a conversation

Primary LanguageJava

Spring AI Chat Memory: Build Smarter Conversational Applications

This repository demonstrates how to use Spring AI's InMemoryChatMemory implementation to manage chat conversations efficiently.

πŸš€ It covers two key use cases:

  • A shared in-memory chat memory for all users.
  • A user-specific in-memory chat memory to maintain individual conversation history.

πŸ“– Dive Deeper: For a complete walkthrough and detailed explanation, read our blog:
πŸ‘‰ Spring AI Chat Memory: Build Smarter Conversational Applications

πŸŽ₯ Prefer a visual walkthrough? Here’s a YouTube demo wherein I’ve explained the implementation step by step: πŸ‘‰ https://youtu.be/QTaCb7lxyL8


πŸ“Œ Important Note

🧠 InMemoryChatMemory Focus

  • This implementation uses InMemoryChatMemory β€” ideal for POCs or applications where persistent storage is not required.
  • Supports both single-session and multi-user chat handling with configurable memory key resolvers.