Spring Boot與Spring Cloud版本技術選型


  Spring Boot與Spring Cloud版本嚴格來將,Boot是以數字作為版本,Cloud是以英語大寫字母開頭作為版本,這些其實都是倫敦地鐵站命名的版本。

一、如何選擇Spring Boot版本?

github源碼地址:https://github.com/spring-projects/spring-boot/wiki

springboot2.0新特性:https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Release-Notes,通過官網發現,Spring Boot官方強烈建議你升級到2.X以上的版本,看不懂英文的自行翻譯:

從2019年10月份以后,Spring Boot2.0版本可以說是非常穩定了。從2020年開始,不推薦使用Spring Boot1.5版本了,推薦使用Spring Boot2.0版本或者更新。

從官網看SpringBoot版本:https://spring.io/projects/spring-boot#learn,目前Spring Boot最新版本如下圖:

使用最新版本就是最好的嗎?其實並不是這樣的,這需要與Spring Cloud版本相對應才行。

 

二、如何選擇Spring Cloud版本?

github源碼地址:https://github.com/spring-projects/spring-cloud/wiki由於Spring Cloud源碼地址非常的懶,Spring Cloud GitHub上面不在進行維護了,如果讀者有興趣請看Spring Cloud官網:https://spring.io/projects/spring-cloud

springcloud版本命名規則:

Spring Cloud 采用了英國倫敦地鐵站的名稱來進行命名,並由地鐵站名稱字母A-Z以此類推的形式來發布迭代的版本。

Spring Cloud 是一個由許多子項目組成的綜合項目,各自項目有不同的發布節奏,為了管理 Spring Cloud 與各個子項目的版本依賴關系,發布了一個清單,其中包括了某個 Spring Cloud 版本對應的子項目版本。為了避免 Spring Cloud 版本號與子項目版本號混淆,Spring Cloud 版本采用了名稱而非版本號的命名,這些版本的名字采用了倫敦地鐵站的名字,根據字母表的順序來對應版本的時間順序。

例如 Angel 是第一個版本,Brixton 是第二個版本。當 Spring Cloud 的發布內容積累到臨界點或者一個重大的 Bug 被解決之后,會發布一個 “service releases”版本,簡稱 SRX 版本,比如 Greenwich.SR2 就是 Spring Cloud 發布的 Greenwich 版本的第二個 SRX 版本。

從官網看SpringCloud版本:https://spring.io/projects/spring-cloud#learn,目前Spring Cloud最新版本如下圖:

 

三、Spring Cloud與Spring Boot之間的依賴關系如何查看

訪問官網地址:https://spring.io/projects/spring-cloud#overview,Spring Cloud和Spring Boot版本對應關系表格如下:

Spring Cloud Version SpringBoot Version
Hoxton 2.2.x
Greenwich 2.1.x
Finchley 2.0.x
Edgware 1.5.x
Dalston 1.5.x

  如果你想使用 Spring Cloud Hoxton 最新版本,Spring Boot 版本必須對應使用 2.2.x 版本,x可以是1、2、3和4等,然而你想使用 Spring Cloud Greenwich 版本,Spring Boot 版本不更改為 2.1.x 版本的話,可能會無法正確引入項目依賴,進行報錯或者是不支持此版本。

版本依賴關系:

  • Finchley 是基於 Spring Boot 2.0.x 構建的不再使用 Spring Boot 1.5.x。

  • Dalston 和 Edgware 是基於 Spring Boot 1.5.x 構建的,不支持 Spring Boot 2.0.x。

  • Camden 構建於 Spring Boot 1.4.x,但依然能支持 Spring Boot 1.5.x。

所以說以前的A-D版本基本上不在推薦使用了,如果現在要使用 Spring Cloud 版本,個人覺得 Greenwich 版本還是比較穩定的,配合 Spring Boot 2.1.x 版本進行使用。

更詳細的版本對應查看方法:

  瀏覽器訪問 https://start.spring.io/actuator/info 監控信息請求地址,如果剛開始查看 JSON 串返回結果看不懂,個人推薦在谷歌瀏覽器擴展程序下載一個叫 JSONView 插件。非常的好用,該插能夠自動識別 JSON 請求數據格式。

我們一起來看一下效果吧:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM