Spring AI 1.0.0-M6
- 入門
- 一、存儲庫
- 二、依賴管理
- 完整maven
入門
Spring 是JAVA中我們經常使用的框架之一,Spring AI不斷的發展迭代目前已經到M6版本據說上半年會出一個穩定版本。
本節提供了如何開始使用Spring AI的M6。
一、存儲庫
1.0 M6 -添加Spring存儲庫
需要將Spring里程碑和快照存儲庫添加到構建系統中。如果您更喜歡手動添加依賴項片段,請按照以下部分中的說明操作。
要使用Milestone和Snapshot版本,您需要在構建文件中添加對Spring Milestone和/或Snapshot存儲庫的引用。
將以下存儲庫定義添加到您的Maven構建文件:
<repositories><repository><id>spring-milestones</id><name>Spring Milestones</name><url>https://repo.spring.io/milestone</url><snapshots><enabled>false</enabled></snapshots></repository><repository><id>spring-snapshots</id><name>Spring Snapshots</name><url>https://repo.spring.io/snapshot</url><releases><enabled>false</enabled></releases></repository>
</repositories>
二、依賴管理
Spring AI Bill of Materials (BOM) 聲明了Spring AI給定版本使用的所有依賴項的推薦版本。 使用應用程序構建腳本中的BOM,無需您自己指定和維護依賴項版本。 相反,您使用的BOM表版本決定了所使用的依賴關系版本。 它還確保您在默認情況下使用依賴項的受支持和測試版本,除非您選擇覆蓋它們。
將BOM表添加到項目中:
<dependencyManagement><dependencies><dependency><groupId>org.springframework.ai</groupId><artifactId>spring-ai-bom</artifactId><version>1.0.0-M6</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement>
完整maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.4.3</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.qijc</groupId><artifactId>ai-springboot-starting</artifactId><version>0.0.1-SNAPSHOT</version><name>ai-springboot-starting</name><description>ai-springboot-starting</description><properties><java.version>17</java.version><spring-ai.version>1.0.0-M6</spring-ai.version></properties><repositories><repository><id>spring-milestones</id><name>Spring Milestones</name><url>https://repo.spring.io/milestone</url><snapshots><enabled>false</enabled></snapshots></repository><repository><id>spring-snapshots</id><name>Spring Snapshots</name><url>https://repo.spring.io/snapshot</url><releases><enabled>false</enabled></releases></repository></repositories><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.ai</groupId><artifactId>spring-ai-bom</artifactId><version>${spring-ai.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>