2014-03-05 349 views
0

我注意到春季啓動樣本數據Redis的聲明瞭以下依賴關係:彈簧引導啓動與彈簧引導起動XXX

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter</artifactId> 
</dependency> 
<dependency> 
    <groupId>org.springframework.data</groupId> 
    <artifactId>spring-data-redis</artifactId> 
</dependency> 

在這裏看到全POMhttps://github.com/spring-projects/spring-boot/blob/v1.0.0.RC4/spring-boot-samples/spring-boot-sample-data-redis/pom.xml

我看沒有提到的<artifactId>spring-boot-starter-redis</artifactId>

我的問題是:當我用spring-boot-starterspring-boot-starter-xxx其中xxx是該項目的名稱(這裏是Redis)?

回答

3

特定問題的答案spring-boot-starter是其他人的基準,對於不使用任何其他Spring組件的獨立(非Web)應用程序,它基本支持Spring,日誌記錄和測試,但沒有別的(沒有webapp功能,沒有數據庫等)。由於所有其他首發都依賴於它,所以一旦你使用另一個首發,你可以取出香草起動器。編輯:看到這裏https://github.com/spring-projects/spring-boot/commit/77fd127e09963a844f8fb4e574e1f0d9d3424d4e

在redis啓動器上由您決定,但如果它存在,我會使用啓動器,因爲它通常會減少需要聲明的依賴項的數量。 redis實際上並沒有增加很多價值(因此它直到最近才存在),但它可能應該在樣本中使用。