javascript
springcloud官方文档_通俗易懂!Spring Cloud简介:官方文档翻译版
什么是微服務?
"微服務架構是一種架構模式,它提倡將單一應用程序劃分成一組小的服務,服務之間相互協調、互相配合,為用戶提供最終價值。每個服務運行在其獨立的進程中,服務和服務之間采用輕量級的通信機制相互溝通(通常是基于HTTP的Restful API).每個服務都圍繞著具體的業務進行構建,并且能夠被獨立的部署到生產環境、類生產環境等。另外,應盡量避免統一的、集中的服務管理機制,對具體的一個服務而言,應根據業務上下文,選擇合適的語言、工具對其進行構" ——Martin Fowler的博客
SpringCloud簡介
SpringCloud用來干嘛?
學習新技術,官網會給出最權威的答案,不妨看看官網對SpringCloud的介紹:
https://spring.io/projects/spring-cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state).
Spring Cloud為開發人員提供了快速構建分布式系統中一些常見模式的工具,如:配置管理【configuration management】,服務發現【service discovery】,熔斷機制【circuit breakers】,智能路由【intelligent routing】,微代理【micro-proxy】,控制總線【control bus】,一次性令牌【one-time tokens】,全局鎖【global locks】,leader投票選舉【leadership election】,分布式會話【distributed sessions】,集群狀態【cluster state】。
特性
Spring Cloud 側重提供開箱即用的典型用例和允許自由擴展的機制。
- Distributed/versioned configuration 分布式/版本控制配置
- Service registration and discovery 服務注冊與發現
- Routing 路由
- Service-to-service calls 服務到服務的調用
- Load balancing 負載均衡
- Circuit Breakers 熔斷機制
- Global locks 全局鎖
- Leadership election and cluster state 選舉與集群狀態管理
- Distributed messaging 分布式消息
構建注意事項
從0到1構建新的SpringCloud工程
最簡單的方法是訪問start.spring.io網站,選擇合適的SpringBoot和SpringCloud版本,進行構建。
在已有SpringBoot應用程序基礎上構建SpringCloud
需要注意版本兼容性,確定你需要的SpringCloud版本,這由原本存在的SpringBoot版本決定。目前的版本依賴關系如下:
需要注意的是Dalston,Edgware,Finchley已經不再支持。
更多詳細的版本對應關系,可以訪問網址:https://start.spring.io/actuator/info
spring-cloud: {//...省略 Greenwich.M1: "Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE", Greenwich.SR6: "Spring Boot >=2.1.0.RELEASE and <2.1.999.BUILD-SNAPSHOT", Greenwich.BUILD-SNAPSHOT: "Spring Boot >=2.1.999.BUILD-SNAPSHOT and <2.2.0.M4", Hoxton.SR9: "Spring Boot >=2.2.0.M4 and <2.3.7.BUILD-SNAPSHOT", Hoxton.BUILD-SNAPSHOT: "Spring Boot >=2.3.7.BUILD-SNAPSHOT and <2.4.0.M1", 2020.0.0-M3: "Spring Boot >=2.4.0.M1 and <=2.4.0.M1", 2020.0.0-M4: "Spring Boot >=2.4.0.M2 and <=2.4.0-M3", 2020.0.0-SNAPSHOT: "Spring Boot >=2.4.0-M4"}spring-cloud-alibaba: {2.2.1.RELEASE: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1"}官方建議:官方通過service release【SR】,將Bug修復和向后兼容的特性添加到每個版本系列中,因此,一旦確定要使用哪個版本的SpringCloud,就應使用該版本系列的最新服務版本。
了解版本對應關系約束必要性之后,便可以引入適當的Spring Cloud BOM了。
Hoxton.SR8org.springframework.cloud spring-cloud-dependencies ${spring.cloud-version}pomimport和SpringBoot一樣,SpringCloud工程也包含starters,你可以為其添加許多不同的特性,并將其作為依賴加入項目之中。大多數情況下,你只需要將starters加入到類路徑下就可以啟用功能。以下展示如何將Spring Cloud Config客戶端和Spring Cloud Netflix Eureka客戶端添加到應用程序:
org.springframework.cloud spring-cloud-starter-config org.springframework.cloud spring-cloud-starter-netflix-eureka-client ...微服務架構
下圖為楊波老師于2018年5月7日在一個可供中小團隊參考的微服務架構技術棧一文中,結合自身的實戰落地經驗,總結的一套貼近國內技術文化特色的輕量級微服務參考技術棧。
SpringCloud的主要項目:
這是SpringCloud官方在維護的項目集合,有些組件功能完全可以被更優秀的框架替代,這個視情況而定。
SpringCloud組件選型
原文鏈接:https://www.cnblogs.com/summerday152/p/14001421.html
如果覺得本文對你有幫助,可以轉發關注支持一下
總結
以上是生活随笔為你收集整理的springcloud官方文档_通俗易懂!Spring Cloud简介:官方文档翻译版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 交警队备案意味什么(交警队备案是什么意思
- 下一篇: (Linux shell)