什麼是Spring Boot?

什麼是Spring Boot?

Spring Boot是Spring開源組織下的子項目,是Spring組件一站式解決方案,主要是簡化了使用Spring的難度,簡省了繁重的配置,提供了各類啓動器,開發者能快速上手。java

官方網站:http://projects.spring.io/spring-boot/
GitHub源碼:https://github.com/spring-projects/spring-bootgit

Spring Boot的優勢

Featuresgithub

  • Create stand-alone Spring applications
  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
  • Provide opinionated 'starter' POMs to simplify your Maven configuration
  • Automatically configure Spring whenever possible
  • Provide production-ready features such as metrics, health checks and externalized configuration
  • Absolutely no code generation and no requirement for XML configuration
  • 獨立運行web

    Spring Boot並且內嵌了各類servlet容器,Tomcat、Jetty等,如今再也不須要打成war包部署到容器中,Spring Boot只要打成一個可執行的jar包就能獨立運行,全部的依賴包都在一個jar包內。spring

  • 簡化配置apache

    spring-boot-starter-web啓動器自動依賴其餘組件,簡少了maven的配置。api

+- org.springframework.boot:spring-boot-starter-web:jar:1.5.6.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.6.RELEASE:compile
|  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.16:compile
|  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.16:compile
|  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.16:compile
+- org.hibernate:hibernate-validator:jar:5.3.5.Final:compile
|  +- javax.validation:validation-api:jar:1.1.0.Final:compile
|  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
|  \- com.fasterxml:classmate:jar:1.3.3:compile
\- org.springframework:spring-webmvc:jar:4.3.10.RELEASE:compile
  • 自動配置tomcat

    Spring Boot能根據當前類路徑下的類、jar包來自動配置bean,如添加一個spring-boot-starter-web啓動器就能擁有web的功能,無需其餘配置。websocket

  • 無代碼生成和XML配置markdown

    Spring Boot配置過程當中無代碼生成,也無需XML配置文件就能完成全部配置工做,這一切都是藉助於條件註解完成的,這也是Spring4.x的核心功能之一。

  • 應用監控

    Spring Boot提供一系列端點能夠監控服務及應用,作健康檢測。

Spring Boot的缺點

Spring Boot雖然上手很容易,但若是你不瞭解其核心技術及流程,因此一旦遇到問題就很棘手,並且如今的解決方案也不是不少,須要一個完善的過程。

推薦:Spring Boot & Cloud 最強技術教程

相關文章
相關標籤/搜索