SpringAI Agent 实战:Java 开发者接入 Agent Skills 指南
最近 AI 领域最火的话题无疑是 Claude Skills,令人惊讶的是 SpringAI 迅速跟进支持了 Skills 功能。对于 Java 开发者而言,这不仅是跟上趋势的机会,更是将工程化思维融入 AI 应用开发的绝佳实践。
本文将通过构建一个代码评审助手(Code Reviewer),演示如何将 SpringAI 与 Skills 结合使用。
一、项目创建与环境准备
1. 基础环境要求
要体验 SpringAI & Skills,建议升级到 SpringAI 2.x 版本,同时 SpringBoot 也可升级至 4.x。
- SpringAI: 2.0.0-M2
- JDK: 21
- SpringBoot: 4.0.1
除了基本依赖外,还需要选择一个支持 Function Tool 的大模型作为核心大脑。这里选用智谱的 GLM-4.5-Flash,因其免费且效果稳定,适合快速验证。
2. 项目依赖配置
创建一个标准的 SpringAI 应用,在 pom.xml 中指定基础版本和仓库地址:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.1</version>
<relativePath/>
</parent>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-ai.version>2.0.0-M2</spring-ai.version>
</>
org.springframework.ai
spring-ai-bom
${spring-ai.version}
pom
import
spring-snapshots
Spring Snapshots
https://repo.spring.io/snapshot
false
Central Portal Snapshots
central-portal-snapshots
https://central.sonatype.com/repository/maven-snapshots/
false
true


