2. 项目依赖
Due to different inception dates of individual Spring Data modules, most of them carry different major and minor version numbers. The easiest way to find compatible ones is by relying on the Spring Data Release Train BOM we ship with the compatible versions defined. In a Maven project you’d declare this dependency in the<dependencyManagement />section of your POM:
由于Spring-Data各模块发布日期不同,大多数模块之间存在主版本号或者次版本号上的差异。最简单的方法就是使用Spring Data Release Train BOM 来保证模块间的兼容性。你可以在POM文件的<dependencyManagement />标签中增加如下定义:
Example 1. Using the Spring Data release train BOM
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>${release-train}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
The current release train version is Gosling-SR4. The train names are ascending alphabetically and currently available ones are listed here. The version name follows the following pattern: ${name}-${release} where release can be one of the following:
当前版本为Gosling-SR4。你可以在这里查看最新进展。
版本号是按照${name}-${release}进行命名的,包含以下几种:
BUILD-SNAPSHOT - current snapshots
M1, M2 etc. - milestones
RC1, RC2 etc. - release candidates
RELEASE - GA release
```SR1, SR2 etc. - service releases
A working example of using the BOMs can be found in our Spring Data examples repository. If that’s in place declare the Spring Data modules you’d like to use without a version in the ```<dependencies />``` block.
使用 BOMs 的例子请参照```Spring Data examples repository```,之后在```<dependencies />```标签中引用Spring-Data模块就不需要在指明版本了:
######Example 2. Declaring a dependency to a Spring Data module