Spring Cloud本质

咱们首先来看看Spring Cloud官方的介绍,其实这一句话基本说出了Spring Cloud的本质。

  Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems.Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer's own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.

  笔者翻译:Spring Cloud提供了一些工具,可以让开发者快速构建基于一些通用模式的分布式应用。分布式应用的协调都遵循“锅炉板模式”(boiler plate patterns),使用Spring Cloud以后,开发者可以更快的构建实现了这些模式的服务和应用。而这些服务和应用,也可以很好的工作在任何分布式环境,包括开发者自己的笔记本,裸金属数据中心以及像Cloud Foundry这样的托管平台。

  和Spring团队以往的做法相似,不管是之前的Spring Framework,还是后来的Spring Boot,Spring团队一直在致力于让开发者可以“更快更好”的做开发。

  这也是为何Spring团队在开发者圈子里口碑一直很好,是因为Spring团队一直在为开发者服务,而且都是开源项目,可以说,Java之所以能这么火,Spring团队功不可没。

  一波隐晦的商业互捧之后,咱们来具体谈一谈,Spring Cloud到底都提供了哪些工具。

  从Spring Cloud官方文档里,我们可以摘取到Spring的核心功能。

Distributed/versioned configuration【分布式以及版本化的配置】

Service registration and discovery【服务注册与发现】

Routing【路由】

Service-to-service calls【服务调用】

Load balancing【负载均衡】

Circuit Breakers【断路器】

Distributed messaging【分布式消息】

  不难发现,其实上面这些功能,就是开发微服务架构下的分布式应用,会经常用到的。

  不过,Spring团队厉害的地方就在于,他们很少会重复造轮子,而是让别人帮他们来造轮子。

  比如最早的Spring framework,Spring只是提供了IOC和AOP的核心功能,而具体的MVC框架、ORM框架、缓存等等,Spring都只是提供了很好的支持和兼容,并不会去自己实现一个。

  当然,除非是对方做的不够好,比如Spring MVC,就是因为当初的Struts2有着诸多的缺陷,才应运而生,并且很快就替代掉了Struts2,成为了主流的MVC框架。

  同样,Spring Cloud也是如此,Spring Cloud的核心并没有实现任何上述功能,让我们来看看Spring Cloud官方文档的一段介绍。

  Many of those features are covered by Spring Boot, on which Spring Cloud builds. Some more features are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope, and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (such as Spring Cloud Netflix and Spring Cloud Consul).

  笔者翻译:

  这些功能(就是上面列举的功能)大部分是由Spring Boot覆盖的,而Spring Cloud基于Spring Boot构建。Spring Cloud作为两个libraries提供了更多的功能。这两个libraries分别是,Spring Cloud Context和Spring Cloud Commons。

  其中Spring Cloud Context提供了一些工具,以及一个Spring Cloud应用的ApplicationContext的特殊服务,比如bootstrap上下文(关于这个家伙,后面有机会笔者会详细介绍)、加密、刷新、环境端点这些功能。

  而Spring Cloud Commons则是一组抽象和在不同Spring Cloud实现(比如Spring Cloud Netflix和Spring Cloud Consul)中使用的通用类。

  可以看出,Spring Cloud其实是一套规范,而不是一个可以拿来即用的框架,而Spring Cloud Netflix以及Spring Cloud Consul,才是Spring Cloud规范的实现。

  当然了,从今天开始,Spring Cloud的实现又多了一种,Spring Cloud Alibaba,-_-。
--------------------- 
作者:左潇龙 
来源:CSDN 
原文:https://blog.csdn.net/zuoxiaolong8810/article/details/83590776 
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值