Java中說到微服務肯定離不開Spring Boot和Spring Cloud,這兩者到底有什么關系,什么是微服務,如果單純的說SpringBoot,SpringCloud,都是不准確的,那應該怎么回答。
-
官網對於Spring Boot的介紹
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".
SpringBoot相對於傳統基於springframework的項目來說,大大簡化了開發配置,當我們指定其Parent版本后,只需要引入需要的Starter就可以快 速開發,實現
just run
,不用再去考慮相關jar包之間的依賴,版本沖突問題,體現了約定大於配置,是一種落地生根的技術。 -
官網對於Spring Cloud的介紹
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems
Spring Cloud為開發人員提供了一些工具來快速構建分布式系統中的一些常見模式(例如配置管理、服務發現、斷路器、網關路由),可以理解為對於微服務中常見的場景和問題,Spring Cloud提供了一站式的解決方案。
-
總結:
Spring Boot build anything 構建一切
Spring Cloud coordinate anything 協調一切
Spring Boot是一種快速開發技術實現,約定大於配置;Spring Cloud提供了微服務系統中一站式的解決方案,每個微服務方案都以Spring Boot為基礎。