SpringAI Agent 实战:利用 Skills 构建代码评审智能体
最近 AI 领域最火的话题无疑是 Claude Skills,而 SpringAI 迅速跟进支持 Skills 的效率令人印象深刻。对于 Java 开发者而言,这不仅是跟上趋势的机会,更是将现有工程化经验迁移到大模型应用开发的契机。
本文将通过构建一个代码评审助手(Code Reviewer),演示如何将 SpringAI 与 Skills 结合使用。
一、项目创建
1. 基础环境要求
体验 SpringAI & Skills 需要较新的版本支持:
- 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


