# 13.5. Starters

Starters是一个依赖描述符的集合，你可以将它包含进项目中，这样添加依赖就非常方便。你可以获取所有Spring及相关技术的一站式服务，而不需要翻阅示例代码，拷贝粘贴大量的依赖描述符。例如，如果你想使用Spring和JPA进行数据库访问，需要在项目中包含`spring-boot-starter-data-jpa`依赖。

该starters包含很多搭建，快速运行项目所需的依赖，并提供一致的，可管理传递性的依赖集。

**名字有什么含义**：所有官方starters遵循相似的命名模式：`spring-boot-starter-*`，在这里`*`是一种特殊的应用程序类型。该命名结构旨在帮你找到需要的starter。很多集成于IDEs中的Maven插件让你通过名称搜索依赖。例如，使用相应的Eclipse或STS插件，你可以在POM编辑器中点击`ctrl-space`，然后输入"spring-boot-starter"就可以获取一个完整列表。 正如[创建自己的starter](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#boot-features-custom-starter)章节中讨论的，第三方starters不应该以`spring-boot`开头，因为它跟Spring Boot官方artifacts冲突。第三方starter通常会用项目的名称开头。例如，一个叫做`thirdpartyproject`的第三方starter项目，通常会被命名为`thirdpartyproject-spring-boot-starter`。

以下应用程序starters是Spring Boot在`org.springframework.boot` group下提供的：

**表 13.1. Spring Boot application starters**

| 名称                                          | 描述                                                                                                                                                                                                                                                                                              | Pom                                                                                                                                                                    |
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| spring-boot-starter                         | 核心starter，包括自动配置支持，日志和YAML                                                                                                                                                                                                                                                                      | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter/pom.xml)                         |
| spring-boot-starter-activemq                | 用于使用Apache ActiveMQ实现JMS消息                                                                                                                                                                                                                                                                      | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-activemq/pom.xml)                |
| spring-boot-starter-amqp                    | 用于使用Spring AMQP和Rabbit MQ                                                                                                                                                                                                                                                                       | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-amqp/pom.xml)                    |
| spring-boot-starter-aop                     | 用于使用Spring AOP和AspectJ实现面向切面编程                                                                                                                                                                                                                                                                  | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-aop/pom.xml)                     |
| spring-boot-starter-artemis                 | 使用Apache Artemis实现JMS消息                                                                                                                                                                                                                                                                         | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-artemis/pom.xml)                 |
| spring-boot-starter-batch                   | 对Spring Batch的支持                                                                                                                                                                                                                                                                                | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-batch/pom.xml)                   |
| spring-boot-starter-cache                   | 用于使用Spring框架的缓存支持                                                                                                                                                                                                                                                                               | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-cache/pom.xml)                   |
| spring-boot-starter-cloud-connectors        | 对Spring Cloud Connectors的支持，用于简化云平台下（例如Cloud Foundry 和Heroku）服务的连接                                                                                                                                                                                                                              | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-cloud-connectors/pom.xml)        |
| spring-boot-starter-data-cassandra          | 用于使用分布式数据库Cassandra和Spring Data Cassandra                                                                                                                                                                                                                                                       | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-cassandra/pom.xml)          |
| spring-boot-starter-data-cassandra-reactive | 用于使用分布式数据库Cassandra和Spring Data Cassandra Reactive                                                                                                                                                                                                                                              | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-cassandra-reactive/pom.xml) |
| spring-boot-starter-data-couchbase          | 用于使用基于文档的数据库Couchbase和Spring Data Couchbase                                                                                                                                                                                                                                                     | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-couchbase/pom.xml)          |
| spring-boot-starter-data-couchbase-reactive | 用于使用基于文档的数据库Couchbase和Spring Data Couchbase Reactive                                                                                                                                                                                                                                            | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-couchbase-reactive/pom.xml) |
| spring-boot-starter-data-elasticsearch      | 用于使用Elasticsearch搜索，分析引擎和Spring Data Elasticsearch                                                                                                                                                                                                                                              | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-elasticsearch/pom.xml)      |
| spring-boot-starter-data-jpa                | 用于使用Hibernate实现Spring Data JPA                                                                                                                                                                                                                                                                  | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-jpa/pom.xml)                |
| spring-boot-starter-data-ldap               | 用于Spring Data LDAP                                                                                                                                                                                                                                                                              | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-ldap/pom.xml)               |
| spring-boot-starter-data-mongodb            | 用于使用基于文档的数据库MongoDB和Spring Data MongoDB                                                                                                                                                                                                                                                         | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-mongodb/pom.xml)            |
| spring-boot-starter-data-mongodb-reactive   | 用于使用基于文档的数据库MongoDB和Spring Data MongoDB Reactive                                                                                                                                                                                                                                                | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-mongodb-reactive/pom.xml)   |
| spring-boot-starter-data-neo4j              | 用于使用图数据库Neo4j和Spring Data Neo4j                                                                                                                                                                                                                                                                 | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-neo4j/pom.xml)              |
| spring-boot-starter-data-redis              | 用于使用Spring Data Redis和Lettuce客户端操作键-值存储的Redis                                                                                                                                                                                                                                                   | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-redis/pom.xml)                   |
| spring-boot-starter-data-redis-reactive     | 用于使用Spring Data Redis reactive和Lettuce客户端操作键-值存储的Redis                                                                                                                                                                                                                                          | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-redis-reactive/pom.xml)     |
| spring-boot-starter-data-rest               | 用于使用Spring Data REST暴露基于REST的Spring Data仓库                                                                                                                                                                                                                                                      | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-rest/pom.xml)               |
| spring-boot-starter-data-solr               | 通过Spring Data Solr使用Apache Solr搜索平台                                                                                                                                                                                                                                                             | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-data-solr/pom.xml)               |
| spring-boot-starter-freemarker              | 用于使用FreeMarker模板引擎构建MVC web应用                                                                                                                                                                                                                                                                   | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-freemarker/pom.xml)              |
| spring-boot-starter-groovy-templates        | 用于使用Groovy模板引擎构建MVC web应用                                                                                                                                                                                                                                                                       | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-groovy-templates/pom.xml)        |
| spring-boot-starter-hateoas                 | 用于使用Spring MVC和Spring HATEOAS实现基于超媒体的RESTful web应用                                                                                                                                                                                                                                              | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-hateoas/pom.xml)                 |
| spring-boot-starter-integration             | 用于使用Spring Integration                                                                                                                                                                                                                                                                          | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-integration/pom.xml)             |
| spring-boot-starter-jdbc                    | 对JDBC的支持（使用Tomcat JDBC连接池）                                                                                                                                                                                                                                                                      | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jdbc/pom.xml)                    |
| spring-boot-starter-jersey                  | 用于使用JAX-RS和Jersey构建RESTful web应用，可使用[spring-boot-starter-web](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-web)替代                                                                                                                            | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jersey/pom.xml)                  |
| spring-boot-starter-jooq                    | 用于使用JOOQ访问SQL数据库，可使用[spring-boot-starter-data-jpa](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-data-jpa)或[spring-boot-starter-jdbc](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-jdbc)替代 | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jooq/pom.xml)                    |
| spring-boot-starter-json                    | 用于读写json                                                                                                                                                                                                                                                                                        | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-json/pom.xmll)                   |
| spring-boot-starter-jta-atomikos            | 用于使用Atomikos实现JTA事务                                                                                                                                                                                                                                                                             | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jta-atomikos/pom.xml)            |
| spring-boot-starter-jta-bitronix            | 用于使用Bitronix实现JTA事务                                                                                                                                                                                                                                                                             | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jta-bitronix/pom.xml)            |
| spring-boot-starter-jta-narayana            | Spring Boot Narayana JTA Starter                                                                                                                                                                                                                                                                | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jta-narayana/pom.xml)            |
| spring-boot-starter-mail                    | 用于使用Java Mail和Spring框架email发送支持                                                                                                                                                                                                                                                                 | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-mail/pom.xml)                    |
| spring-boot-starter-mustache                | 用于使用Mustache模板引擎构建MVC web应用                                                                                                                                                                                                                                                                     | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-mustache/pom.xml)                |
| spring-boot-starter-quartz                  | Spring Boot Quartz Starter                                                                                                                                                                                                                                                                      | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-quartz/pom.xml)                  |
| spring-boot-starter-security                | 对Spring Security的支持                                                                                                                                                                                                                                                                             | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-security/pom.xml)                |
| spring-boot-starter-security-reactive       | 对响应式Spring Security的支持                                                                                                                                                                                                                                                                          | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-security-reactive/pom.xml)       |
| spring-boot-starter-test                    | 用于测试Spring Boot应用，支持常用测试类库，包括JUnit, Hamcrest和Mockito                                                                                                                                                                                                                                            | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-test/pom.xml)                    |
| spring-boot-starter-thymeleaf               | 用于使用Thymeleaf模板引擎构建MVC web应用                                                                                                                                                                                                                                                                    | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-thymeleaf/pom.xml)               |
| spring-boot-starter-validation              | 用于使用Hibernate Validator实现Java Bean校验                                                                                                                                                                                                                                                            | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-validation/pom.xml)              |
| spring-boot-starter-web                     | 用于使用Spring MVC构建web应用，包括RESTful。Tomcat是默认的内嵌容器                                                                                                                                                                                                                                                  | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-web/pom.xml)                     |
| spring-boot-starter-web-services            | 对Spring Web服务的支持                                                                                                                                                                                                                                                                                | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-web-services/pom.xml)            |
| spring-boot-starter-webflux                 | 提供用Spring框架创建webflux应用的支持                                                                                                                                                                                                                                                                       | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-webflux/pom.xml)                 |
| spring-boot-starter-websocket               | 用于使用Spring框架的WebSocket支持构建WebSocket应用                                                                                                                                                                                                                                                           | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-websocket/pom.xml)               |

除了应用程序starters，以下starters可用于添加[production ready](https://jack80342.gitbook.io/spring-boot/v.-spring-boot-actuator)的功能：

**表 13.2. Spring Boot生产级starters**

| 名称                           | 描述                                                           | Pom                                                                                                                                                     |
| ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| spring-boot-starter-actuator | 用于使用Spring Boot的Actuator，它提供了production ready功能来帮助你监控和管理应用程序 | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-actuator/pom.xml) |

最后，Spring Boot还包含以下用于排除或交换某些特定技术方面的starters：

**表 13.3. Spring Boot技术性starters**

| 名称                                | 描述                                                                                                                                                                   | Pom                                                                                                                                                          |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| spring-boot-starter-jetty         | 用于使用Jetty作为内嵌servlet容器，可使用[spring-boot-starter-tomcat](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-tomcat)替代     | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-jetty/pom.xml)         |
| spring-boot-starter-log4j2        | 用于使用Log4j2记录日志，可使用[spring-boot-starter-logging](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-logging)代替           | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-log4j2/pom.xml)        |
| spring-boot-starter-logging       | 用于使用Logback记录日志，默认的日志starter                                                                                                                                         | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-logging/pom.xml)       |
| spring-boot-starter-reactor-netty | 使用Reactor Netty做为内嵌的HTTP服务器                                                                                                                                          | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-reactor-netty/pom.xml) |
| spring-boot-starter-tomcat        | 用于使用Tomcat作为内嵌servlet容器，[spring-boot-starter-web](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-web)使用的默认servlet容器 | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-tomcat/pom.xml)        |
| spring-boot-starter-undertow      | 用于使用Undertow作为内嵌servlet容器，可使用[spring-boot-starter-tomcat](https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#spring-boot-starter-tomcat)替代  | [Pom](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-starters/spring-boot-starter-undertow/pom.xml)      |

**注**：查看GitHub上位于`spring-boot-starters`模块内的[README文件](https://github.com/spring-projects/spring-boot/tree/master/spring-boot-project/spring-boot-starters/README.adoc)，可以获取到一个社区贡献的其他starters列表。
