Spring Cloud Alibaba 微服务架构

开篇(零)

2019-07-09  本文已影响10人  匆匆岁月

引言

而从那天起一个新的微服务领袖诞生了。

什么是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 Cloud提供了那些工具

  • 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有着诸多的缺陷,Spring团队看不下去,才站出来发不了SpringMVC(个人理解),进而成立现金主流的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 ContextSpring Cloud Commons

  • Spring Cloud Context提供了一些工具,以及一个Spring Cloud应用的
    ApplicationContext的特殊服务,比如bootstrap上下文(关于这个家伙,后面有机会笔者会详细介绍)、加密、刷新、环境端点这些功能。
  • Spring Cloud Commons则是一组抽象和在不同Spring Cloud实现(比如Spring Cloud Netflix和Spring Cloud Consul)中使用的通用类。

从官方介绍也可以看出Spring Cloud其实就是一套规范,而不是一个可以直接拿来使用的即用的框架。而Spring Cloud Negflix以及Spring Cloud Consul,才是基于Spring Cloud规范的实现方。

而从Spring Cloud Alibaba发布那天开始,Spring Cloud的实现又多了一种。
接下来的文章我们就来认识下什么是Spring Cloud Alibaba,以及它如何使用。

上一篇 下一篇

猜你喜欢

热点阅读