spring boot Starters

13.5. Starters

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

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

名字有什么含义:所有官方starters遵循相似的命名模式:spring-boot-starter-*,在这里*是一种特殊的应用程序类型。该命名结构旨在帮你找到需要的starter。很多集成于IDEs中的Maven插件允许你通过名称name搜索依赖。例如,使用相应的Eclipse或STS插件,你可以简单地在POM编辑器中点击ctrl-space,然后输入"spring-boot-starter"就可以获取一个完整列表。正如Creating your own starter章节中讨论的,第三方starters不应该以spring-boot开头,因为它跟Spring Boot官方artifacts冲突。一个acme的第三方starter通常命名为acme-spring-boot-starter

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

表 13.1. Spring Boot application starters

名称描述Pom
spring-boot-starter-test用于测试Spring Boot应用,支持常用测试类库,包括JUnit, Hamcrest和MockitoPom
spring-boot-starter-mobile用于使用Spring Mobile开发web应用Pom
spring-boot-starter-social-twitter对使用Spring Social Twitter的支持Pom
spring-boot-starter-cache用于使用Spring框架的缓存支持Pom
spring-boot-starter-activemq用于使用Apache ActiveMQ实现JMS消息Pom
spring-boot-starter-jta-atomikos用于使用Atomikos实现JTA事务Pom
spring-boot-starter-aop用于使用Spring AOP和AspectJ实现面向切面编程Pom
spring-boot-starter-web用于使用Spring MVC构建web应用,包括RESTful。Tomcat是默认的内嵌容器Pom
spring-boot-starter-data-elasticsearch用于使用Elasticsearch搜索,分析引擎和Spring Data ElasticsearchPom
spring-boot-starter-jdbc对JDBC的支持(使用Tomcat JDBC连接池)Pom
spring-boot-starter-batch对Spring Batch的支持Pom
spring-boot-starter-social-facebook用于使用Spring Social FacebookPom
spring-boot-starter-web-services对Spring Web服务的支持Pom
spring-boot-starter-jta-narayanaSpring Boot Narayana JTA StarterPom
spring-boot-starter-thymeleaf用于使用Thymeleaf模板引擎构建MVC web应用Pom
spring-boot-starter-mail用于使用Java Mail和Spring框架email发送支持Pom
spring-boot-starter-jta-bitronix用于使用Bitronix实现JTA事务Pom
spring-boot-starter-data-mongodb用于使用基于文档的数据库MongoDB和Spring Data MongoDBPom
spring-boot-starter-validation用于使用Hibernate Validator实现Java Bean校验Pom
spring-boot-starter-jooq用于使用JOOQ访问SQL数据库,可使用spring-boot-starter-data-jpaspring-boot-starter-jdbc替代Pom
spring-boot-starter-redis用于使用Spring Data Redis和Jedis客户端操作键-值存储的Redis,在1.4中已被spring-boot-starter-data-redis取代Pom
spring-boot-starter-data-cassandra用于使用分布式数据库Cassandra和Spring Data CassandraPom
spring-boot-starter-hateoas用于使用Spring MVC和Spring HATEOAS实现基于超媒体的RESTful web应用Pom
spring-boot-starter-integration用于使用Spring IntegrationPom
spring-boot-starter-data-solr通过Spring Data Solr使用Apache Solr搜索平台Pom
spring-boot-starter-freemarker用于使用FreeMarker模板引擎构建MVC web应用Pom
spring-boot-starter-jersey用于使用JAX-RS和Jersey构建RESTful web应用,可使用spring-boot-starter-web替代Pom
spring-boot-starter核心starter,包括自动配置支持,日志和YAMLPom
spring-boot-starter-data-couchbase用于使用基于文档的数据库Couchbase和Spring Data CouchbasePom
spring-boot-starter-artemis使用Apache Artemis实现JMS消息Pom
spring-boot-starter-cloud-connectors对Spring Cloud Connectors的支持,用于简化云平台下(例如Cloud Foundry 和Heroku)服务的连接Pom
spring-boot-starter-social-linkedin用于使用Spring Social LinkedInPom
spring-boot-starter-velocity用于使用Velocity模板引擎构建MVC web应用,从1.4版本过期Pom
spring-boot-starter-data-rest用于使用Spring Data REST暴露基于REST的Spring Data仓库Pom
spring-boot-starter-data-gemfire用于使用分布式数据存储GemFire和Spring Data GemFirePom
spring-boot-starter-groovy-templates用于使用Groovy模板引擎构建MVC web应用Pom
spring-boot-starter-amqp用于使用Spring AMQP和Rabbit MQPom
spring-boot-starter-hornetq用于使用HornetQ实现JMS消息,被spring-boot-starter-artemis取代Pom
spring-boot-starter-ws用于使用Spring Web服务,被spring-boot-starter-web-services取代Pom
spring-boot-starter-security对Spring Security的支持Pom
spring-boot-starter-data-redis用于使用Spring Data Redis和Jedis客户端操作键—值数据存储RedisPom
spring-boot-starter-websocket用于使用Spring框架的WebSocket支持构建WebSocket应用Pom
spring-boot-starter-mustache用于使用Mustache模板引擎构建MVC web应用Pom
spring-boot-starter-data-neo4j用于使用图数据库Neo4j和Spring Data Neo4jPom
spring-boot-starter-data-jpa用于使用Hibernate实现Spring Data JPAPom

除了应用程序starters,以下starters可用于添加production ready的功能:

表 13.2. Spring Boot生产级starters

名称描述Pom
spring-boot-starter-actuator用于使用Spring Boot的Actuator,它提供了production ready功能来帮助你监控和管理应用程序Pom
spring-boot-starter-remote-shell用于通过SSH,使用CRaSH远程shell监控,管理你的应用Pom

最后,Spring Boot还包含一些用于排除或交换某些特定技术方面的starters:

表 13.3. Spring Boot技术性starters

名称描述Pom
spring-boot-starter-undertow用于使用Undertow作为内嵌servlet容器,可使用spring-boot-starter-tomcat替代Pom
spring-boot-starter-logging用于使用Logback记录日志,默认的日志starterPom
spring-boot-starter-tomcat用于使用Tomcat作为内嵌servlet容器,spring-boot-starter-web使用的默认servlet容器Pom
spring-boot-starter-jetty用于使用Jetty作为内嵌servlet容器,可使用spring-boot-starter-tomcat替代Pom
spring-boot-starter-log4j2用于使用Log4j2记录日志,可使用spring-boot-starter-logging代替Pom

:查看GitHub上位于spring-boot-starters模块内的README文件,可以获取到一个社区贡献的其他starters列表。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值