SpringAI 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>
</properties>
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




