【问题标题】:spring-boot-starter versus spring-boot-starter-xxxspring-boot-starter vs spring-boot-starter-xxx
【发布时间】:2014-04-07 20:32:17
【问题描述】:

我注意到 Spring Boot Sample Data Redis 声明了以下依赖项:

<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

我没有看到提到&lt;artifactId&gt;spring-boot-starter-redis&lt;/artifactId&gt;

我的问题是:我什么时候使用spring-boot-starter spring-boot-starter-xxx 其中xxx 是项目的名称(这里是Redis)?

【问题讨论】:

    标签: spring-boot


    【解决方案1】:

    具体问题的答案:spring-boot-starter 是其他应用程序的基准,也适用于不使用任何其他 Spring 组件的独立(非 Web)应用程序 - 它对 Spring、Logging 和 Testing 具有基本支持,但仅此而已(没有 webapp 功能,没有数据库等)。由于所有其他开胃菜都依赖于它,因此一旦您使用另一个开胃菜,您就可以移除香草开胃菜。编辑:见这里https://github.com/spring-projects/spring-boot/commit/77fd127e09963a844f8fb4e574e1f0d9d3424d4e

    redis 启动器由您决定,但如果存在启动器,我会使用它,因为它通常会减少您需要声明的依赖项数量。 redis 实际上并没有增加很多价值(因此它直到最近才存在),但它可能应该在示例中使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-04
      • 2016-01-29
      • 2015-07-07
      • 2017-02-19
      • 1970-01-01
      • 2019-10-28
      • 2021-05-07
      • 1970-01-01
      相关资源
      最近更新 更多