Spring Boot 常用 Starter

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_26765193/article/details/84066468

Spring Boot 通过 Starter 来提供系统服务,Spring Boot 已经提供了一系列 Starter,也可以开发自己的 Starter。比如需要开发一个 Web 应用,只要在 pom.xml 中声明一下即可。

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

如果项目中用到了 Redis,则使用 spring-boot-starter-data-redis,Spring Boot 会自动为你配置好 Spring 需要的各种配置文件、Redis 的 jar 包、依赖包,以及合适的版本,下表是 Spring Boot 提供的常用 Starter。

Spring Boot 常用 Starter
名称 作用
spring-boot-starter-web Web 开发支持,默认使用 Tomcat8
spring-boot-starter-aop AOP 开发支持,使用 AspectJ
spring-boot-starter-jdbc Spring JDBC
spring-boot-starter-data-jpa JPA 方式访问数据库,使用 Hibernate 作为 JPA实现
spring-boot-starter-data-elasticsearch 集成 Elasticsearch,默认使用 localhost:9200
spring-boot-starter-data-redis 集成 Redis,使用 JRedis,默认连接 localhost:6379
spring-boot-starter-cache 缓存,支持多种缓存方式,如本地的、Redis、Ehcache 等
spring-boot-devtools 应用程序快速重启工具,提升开发体验
spring-boot-starter-data-mongodb 集成 MongoDB,默认访问 mongdb://localhost/test
spring-boot-starter-data-neo4j 集成 neo4j,默认访问 localhost:7474
spring-boot-starter-data-gemfire 集成分布式缓存
spring-boot-starter-data-solr 集成 Apache lucene 的搜索平台,默认访问 http://localhost:8983/solr
spring-boot-starter-data-cassandra 集成 Cassandra,默认访问 localhost:7474
spring-boot-starter-data-ldap 集成 ldap
spring-boot-starter-activemq 消息集成 ActiveMQ 支持
spring-boot-starter-amqp 消息集成 AMQP 协议支持,如支持 RabbitMQ
spring-boot-starter-jta-atomikos 分布式事务支持,使用 atomikos
spring-boot-starter-jta-bitronix 一个开源的分布式事务支持
spring-boot-starter-test 包含 JUnit、Spring Test、Hamcrest、Mockito 等测试工具
spring-boot-starter-webservices webservices 支持
spring-boot-starter-websocket websocket 支持
spring-boot-starter-jersey REST 应用和 Jersey 支持
spring-boot-starter-freemarker Freemarker 支持

相比于 Spring , Spring Boot 具有以下优点:

  • 实现约定大于配置,是一个低配置的应用系统框架。不像 Spring 那样繁琐的配置,Spring Boot 不需要配置或者极少配置,就能使用 Spring 大量的功能。
  • 提供了内置的 Tomcat 或者 Jetty 容器。
  • 通过依赖的 jar 包管理、自动装备技术,容易支持与其他技术体系、工具集成。
  • 支持热加载,开发体验好。也支持 Spring Boot 系统监控,方便了解系统运行状况。

猜你喜欢

转载自blog.csdn.net/qq_26765193/article/details/84066468