SpringBoot是什么?

Spring Boot是什么?

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run"

官方网站

引用官方的一句概述,Spring Boot可以让你轻松的创建依赖于Spring框架的企业级应用,真正做到一键启动。

Spring的强大之处在于提供了对Java企业级框架的统一管理,整合资源的能力,但是使用传统SSM或者SSH框架创建一个web应用也并没有那么容易,需要引入一系列的依赖,要解决版本兼容问题,还要配置web.xml,配置Spring MVC,Mybatis,Hibernate等等,重复且繁琐。

Spring Boot封装了一系列的场景启动器,也就是官方提供的starter,你不需要再关心依赖冲突版本兼容等等问题,Spring官方提供了一套最优解,约定大于配置。

Starters是什么

Starters可以理解为启动器,它包含了一系列可以集成到应用里面的依赖包,你可以一站式集成Spring及其他技术,而不需要到处找示例代码和依赖包。如你想使用Spring JPA访问数据库,只要加入spring-boot-starter-data-jpa启动器依赖就能使用了。

Starters命名规则

Spring Boot官方的启动器都是以spring-boot-starter-命名的,代表了一个特定的应用类型。第三方的启动器不能以spring-boot开头命名,它们都被Spring Boot官方保留。一般一个第三方的应该这样命名,像mybatis的mybatis-spring-boot-starter。

启动器种类

Spring Boot应用启动器基本的一共有N(现知道的是44)种:具体如下:

spring-boot-starter     这是Spring Boot的核心启动器,包含了自动配置、日志和YAML。
spring-boot-starter-actuator     帮助监控和管理应用。
spring-boot-starter-amqp     通过spring-rabbit来支持AMQP协议。
spring-boot-starter-aop     支持面向方面的编程即AOP,包括spring-aop和AspectJ。
spring-boot-starter-artemis     通过Apache Artemis支持JMS的API(Java Message Service API)。
spring-boot-starter-batch     支持Spring Batch,包括HSQLDB数据库。
spring-boot-starter-cache     支持Spring的Cache抽象。
spring-boot-starter-cloud-connectors    支持Spring Cloud Connectors,简化了在像Cloud Foundry或Heroku这样的云平台上连接服务。
spring-boot-starter-data-elasticsearch    支持ElasticSearch搜索和分析引擎,包括spring-data-elasticsearch。
spring-boot-starter-data-gemfire    支持GemFire分布式数据存储,包括spring-data-gemfire。
spring-boot-starter-data-jpa    支持JPA、包括spring-data-jpa、spring-orm、Hibernate。
spring-boot-starter-data-mongodb    支持MongoDB数据,包括spring-data-mongodb。
spring-boot-starter-data-rest    支持通过REST暴露Spring Data数据仓库。
spring-boot-starter-data-solr     支持Apache Solr搜索平台,包括spring-data-solr。
spring-boot-starter-freemarker    支持FreeMarker模板引擎。
spring-boot-starter-groovy-templates    支持Groovy模板引擎。
spring-boot-starter-hateoas    通过spring-hateoas支持基于HATEOAS的RESTful Web服务。
spring-boot-starter-hornetq    通过HornetQ支持JMS。
spring-boot-starter-integration    支持通用的spring-integration模块。
spring-boot-starter-jdbc    支持JDBC数据库。
spring-boot-starter-jersey    支持Jersey RESTful Web服务框架。
spring-boot-starter-jta-atomikos    通过Atomikos支持JTA分布式事务处理。
spring-boot-starter-jta-bitronix    通过Bitronix支持JTA分布式事务处理。
spring-boot-starter-mail    支持javax.mail模块。
spring-boot-starter-mobile    支持spring-mobile。
spring-boot-starter-mustache     支持Mustache模板引擎。
spring-boot-starter-redis    支持Redis键值存储数据库,包括spring-redis。
spring-boot-starter-security    支持spring-security。
spring-boot-starter-social-facebook    支持spring-social-facebook
spring-boot-starter-social-linkedin    支持pring-social-linkedin
spring-boot-starter-social-twitter    支持pring-social-twitter
spring-boot-starter-test    支持常规测试依赖,包括JUnit、Hamcrest、Mockito、spring-test模块。
spring-boot-starter-thymeleaf    支持Thymeleaf模板引擎,包括与Spring的集成。
spring-boot-starter-velocity    支持Velocity模板引擎。
spring-boot-starter-web    支持全栈式Web开发,包括Tomcat和spring-webmvc。
spring-boot-starter-websocket    支持WebSocket开发。
spring-boot-starter-ws    支持Spring Web Services。

Spring Boot应用启动器面向生产环境的还有2种,具体如下:

spring-boot-starter-actuator    增加了面向产品上线相关的功能,比如测量和监控。
spring-boot-starter-remote-shell    增加了远程ssh shell的支持。

最后,Spring Boot应用启动器还有一些替换技术的启动器,具体如下:

spring-boot-starter-jetty    引入了Jetty HTTP引擎(用于替换Tomcat)。
spring-boot-starter-log4j    支持Log4J日志框架。
spring-boot-starter-logging    引入了Spring Boot默认的日志框架Logback。
spring-boot-starter-tomcat    引入了Spring Boot默认的HTTP引擎Tomcat。
spring-boot-starter-undertow     引入了Undertow HTTP引擎(用于替换Tomcat)。
posted @ 2020-02-05 20:18  星光Starsray  阅读(507)  评论(0编辑  收藏  举报