🚀🚀🚀 Spring AI Summary is a collection of sample projects based on native Spring AI, designed to help developers quickly master the core features and usage of the Spring AI framework. With a modular design, each module focuses on a specific functional area, providing clear code examples and detailed documentation to help you get started easily and deeply understand the core concepts of the framework.
- Modular Design: Each module focuses on a functional area, such as chat, RAG (Retrieval Augmented Generation), text embedding, tool function calling, chat memory management, etc., making it easy for developers to learn and apply as needed.
- Practical Examples: Each module contains complete sample code and documentation, demonstrating real-world application scenarios of Spring AI, helping you quickly build your own AI applications.
- Continuous Updates: The project keeps up with the latest developments and version updates of Spring AI, optimizing sample code and documentation in a timely manner to ensure content is always up-to-date.
- Community Support: High-quality technical articles and practical experience are shared, offering best practices to help developers better understand and apply Spring AI.
Spring AI Summary is for developers interested in the Spring AI framework. Whether you are a beginner or an experienced engineer, you can quickly learn the core features of the framework and apply them to real projects through this project.
With Spring AI Summary, you can:
- Master the core concepts and features of Spring AI.
- Learn how to build efficient AI applications.
- Get the latest technical trends and practical experience.
Welcome to join the community and explore the infinite possibilities of Spring AI together!
This project adopts a modular design, mainly divided into the following modules by feature:
spring-ai-summary/
├── spring-ai-chat/ # Chat module
│ ├── spring-ai-chat-openai/ # OpenAI integration
│ ├── spring-ai-chat-qwen/ # Qwen integration
│ ├── spring-ai-chat-doubao/ # Doubao integration
│ ├── spring-ai-chat-deepseek/ # DeepSeek integration
│ ├── spring-ai-chat-multi/ # Multi chat model
│ │ spring-ai-chat-ollama/ # Ollama integration
│ └── spring-ai-chat-multi-openai/ # Multi OpenAI protocol models
├── spring-ai-rag/ # RAG (Retrieval Augmented Generation)
├── spring-ai-vector/ # Text embedding service
│ ├── spring-ai-vector-milvus/ # Milvus vector storage
│ ├── spring-ai-vector-redis/ # Redis vector storage
├── spring-ai-tool-calling/ # Tool/function calling examples
├── spring-ai-chat-memory/ # Chat memory management
│ ├── spring-ai-chat-memory-jdbc # JDBC-based storage
│ ├── spring-ai-chat-memory-local # In-memory storage
├── spring-ai-evaluation/ # AI answer evaluation
└── spring-ai-mcp/ # MCP examples
├── spring-ai-mcp-server # MCP server
├── spring-ai-mcp-client # MCP client
└── spring-ai-agent/ # Agent examples
| Dependency | Version/Requirement | Note |
|---|---|---|
| SpringBoot | 3.3.6 | |
| Spring AI | 1.0.0 | |
| JDK | 21+ | |
| Maven | 3.6+ | |
| Docker | (for running Milvus) |
# Clone the project
git clone https://github.com/java-ai-tech/spring-ai-summary.git
# Enter the project directory and compile
cd spring-ai-summary && mvn clean compile -DskipTestsIf you encounter slow Maven dependency downloads, try using a domestic Maven mirror (e.g., Aliyun, Tsinghua). For any other issues, feel free to join the WeChat group above for discussion and support.
For each module, configure the required API keys in the application.yml/application.properties file under the resources folder. For example, in spring-ai-chat-deepseek:
# because we do not use the OpenAI protocol
spring.ai.deepseek.api-key=${spring.ai.deepseek.api-key}
spring.ai.deepseek.base-url=https://api.deepseek.com
spring.ai.deepseek.chat.completions-path=/v1/chat/completions
spring.ai.deepseek.chat.options.model=deepseek-chatReplace spring.ai.deepseek.api-key with your actual API key to start the service. For how to apply for an API key, see the project Wiki page.
There's a one-time setup solution: add the spring.ai.deepseek.api-key to your environment variables. This will be automatically loaded during subsequent application startups without needing code modifications in application.yml, eliminating concerns about accidentally committing the code and exposing the key.
In IntelliJ IDEA's launch configuration, add the environment variable spring.ai.openai.api-key=sk-***************(your_actual_key). The project will automatically include this environment variable when running.
Note: Each submodule requires separate configuration for this setting.
After the above steps, you can run different modules to experience Spring AI features. For example, to start spring-ai-chat-deepseek (port may vary):
2025-06-04T14:18:43.939+08:00 INFO 88446 --- [spring-ai-chat-deepseek] [ main] c.g.ai.chat.deepseek.DsChatApplication : Starting DsChatApplication using Java 21.0.2 with PID 88446 (/Users/glmapper/Documents/projects/glmapper/spring-ai-summary/spring-ai-chat/spring-ai-chat-deepseek/target/classes started by glmapper in /Users/glmapper/Documents/projects/glmapper/spring-ai-summary)
...Once started, you can test with cUrl, HTTPie, or Postman:
curl localhost:8081/api/deepseek/chatWithMetric?userInput="Who are you?"Result:
You can also check token usage:
# completion tokens
http://localhost:8081/actuator/metrics/ai.completion.tokens
# prompt tokens
http://localhost:8081/actuator/metrics/ai.prompt.tokens
# total tokens
http://localhost:8081/actuator/metrics/ai.total.tokensExample response for ai.completion.tokens:
{
"name": "ai.completion.tokens",
"measurements": [
{
"statistic": "COUNT",
"value": 34
}
],
"availableTags": []
}For usage and configuration of other modules, see the Wiki page or each module's README.md.
Here are some recommended learning resources:
The official Awesome Spring AI list is also available, but it mainly collects overseas resources. This project focuses on aggregating domestic learning resources for your reference.
- MindMark: A RAG system based on SpringAI
- My AI Agent: An intelligent agent service based on Spring Boot and Spring AI
- MaJiang's Spring AI Series (Chinese, some content may be outdated)
- In-depth Spring AI Series (Chinese, discontinued)
- How to Build MCP Client-Server Architecture with Spring AI
- Building Effective Agents with Spring AI
- Spring AI Large Model Output Formatting and Simple Usage
- Spring AI EmbeddingModel Concept and Source Code Analysis
If you have good articles or resources, feel free to submit a PR or Issue to supplement and improve this list. See below for development and contribution guidelines.
-
Fork the project
# Fork on GitHub # Clone your fork git clone https://github.com/your-username/spring-ai-summary.git cd spring-ai-summary
-
Create a feature branch
# Create and switch to a new feature branch git checkout -b feature/your-feature-name -
Development standards
- Follow the project's code style and naming conventions
- Ensure all tests pass
- Add necessary unit tests
- Update relevant documentation
- Use Conventional Commits for commit messages
-
Commit your code
git add . git commit -m "feat: add new feature" git push origin feature/your-feature-name
-
Create a Pull Request
- Create a PR on GitHub
- Describe your changes and reasons
- Wait for review and merge
-
API Key Security
- Use environment variables to store API keys to avoid leaks
- Never hardcode keys in the codebase
- Rotate keys regularly for better security
-
Token Usage
- Monitor token consumption to avoid overuse
- Set reasonable token limits to prevent abuse
- Implement caching to improve response speed and cost control
-
- This project is licensed under the MIT License. See LICENSE for details. This project is for learning and research only, not for production use. Please comply with the terms and conditions of the models you use.
-
- All code and documentation are independently developed and maintained by glmapper. Feedback and suggestions are welcome! If you find this project helpful, please give it a Star. For questions or suggestions, submit an Issue or PR on GitHub, or contact me via here. More Spring AI technical articles will be published in this repo and on my WeChat public account: 磊叔的技术博客 (scan below to follow).
- Spring AI - Powerful AI integration framework
- OpenAI - GPT series models
- Qwen - Qwen series models
- Doubao - Doubao series models
- Milvus - Vector database support
This project is fully open source, aiming to aggregate more high-quality Spring AI learning resources. Most resources are collected from the internet. If there is any infringement, please contact for removal. Special thanks to all open source contributors and everyone who shares technology in the community!


