table of Contents
1. Introduction to Spring Cloud Alibaba
Spring Cloud Alibaba is a one-stop solution for microservice development provided by Alibaba. It is the integration of Alibaba's open source middleware and the Spring Cloud system.
Teacher Ma left double eleven, right hand Ali open source components, not only occupy the programmer's shopping cart, but also occupy everyone's development tools.
1.1. Let me talk about Spring Cloud first
Lift the micro-services, I must mention Spring Cloud全家桶系列
, SpringCloud
is a collection of several frameworks, including spring-cloud-eureka
, spring-cloud-zuul
, spring-cloud-config
, spring-cloud-bus
and nearly 20 sub-projects, provides service management, service gateways, intelligent routing, load balancing, circuit breakers, monitors tracking, distributed message queue, Solutions in areas such as configuration management.
Spring Cloud
By Spring Boot
style package, it masked the complexity of configuration and implementation principles, and ultimately to the developer set aside a set of simple and easy to understand, easy to deploy distributed systems development kit.
Generally speaking, it Spring Cloud
contains the following components, mainly based on Netflix open source:
1.2.Spring Cloud Alibaba
In the past two years, Ali has launched a new generation of microservice component framework Spring Cloud Alibaba. As for why it appears, the most important reason is that almost all components in Spring Cloud use Netflix products, and then a layer of encapsulation is made on the basis, and many Netflix components such as Eureka have stopped updating.
Spring Cloud Alibaba is committed to providing a one-stop solution for microservice development. This project contains the necessary components for the development of distributed application microservices, so that developers can easily use these components to develop distributed application services through the Spring Cloud programming model.
Relying on Spring Cloud Alibaba, you only need to add some annotations and a small amount of configuration to connect Spring Cloud applications to Ali's microservice solutions, and quickly build a distributed application system through Ali's middleware.
Spring Cloud Alibaba GitHub address
Spring Cloud Alibaba official documentation
To Spring Cloud Alibaba
contribute code to refer to how to contribute .
2. Main functions
Services limiting downgrade : the default support WebServlet
, WebFlux
, OpenFeign
, RestTemplate
, Spring Cloud Gateway
, Zuul
, Dubbo
and RocketMQ
access limiting downgrade can be modified at runtime by the console in real time limiting downgrade rules, limiting downgrade also supports viewing Metrics
monitor.
Service registration and discovery : adaptation Spring Cloud
service registration and discovery standard, the default integrated Ribbon
support.
Distributed configuration management : Supports externalized configuration in distributed systems, and automatically refreshes when configuration changes.
Message-driven capacity : based on Spring Cloud Stream
building capacity for the message-driven micro-service applications.
Distributed Transactions : Use @GlobalTransactional
annotations, efficient and zero-invasive solution to the business problem of distributed transactions.
Alibaba Cloud Object Storage: Massive, secure, low-cost, and highly reliable cloud storage services provided by Alibaba Cloud. Support for storing and accessing any type of data in any application, any time, and any place.
Distributed task scheduling : Provides second-level, accurate, highly reliable, and highly available timing (based on Cron expression) task scheduling services. At the same time, it provides distributed task execution models, such as grid tasks. The grid task supports the uniform distribution of sea quantum tasks to all workers (schedulerx-client) for execution.
Alibaba Cloud Short Message Service : A global short message service with friendly, efficient, and intelligent interconnected communication capabilities to help companies quickly build customer access channels.
3. Main components
The following picture (picture comes from the network) is a Spring Cloud Alibaba
series of components, including Alibaba open source components, Alibaba Cloud commercial components, and integrated Spring Cloud components:
Sentinel : Use traffic as an entry point, from traffic control, fuse downgrade, system load protection, etc. Multiple dimensions protect the stability of the service.
Nacos : A dynamic service discovery, configuration management and service management platform that makes it easier to build cloud-native applications.
RocketMQ : An open source distributed messaging system, based on high-availability distributed cluster technology, provides low-latency, highly reliable message publishing and subscription services.
Dubbo : Apache Dubbo™ is a high-performance Java RPC framework.
Seata : Alibaba's open source product, an easy-to-use high-performance microservice distributed transaction solution.
Alibaba Cloud OSS : Alibaba Cloud Object Storage Service (OSS) is a massive, secure, low-cost, and highly reliable cloud storage service provided by Alibaba Cloud . You can store and access any type of data in any application, any time, and any place.
Alibaba Cloud SchedulerX: A distributed task scheduling product developed by the Alibaba middleware team, providing second-level, accurate, highly reliable, and highly available timing (based on Cron expressions) task scheduling services.
Alibaba Cloud SMS : A global SMS service, friendly, efficient, and intelligent interconnected communication capabilities, helping companies quickly build customer access channels.
4. How to build
The master branch corresponds to the Spring Cloud Greenwich
minimum support JDK 1.8
.
The finchley branch corresponds to the Spring Cloud Finchley
minimum support JDK 1.8
.
The 1.x branch corresponds to the Spring Cloud Edgware
minimum support JDK 1.7
.
Spring Cloud uses Maven to build. The fastest way to use it is to clone this project locally, and then execute the following commands:
./mvnw install
After execution, the project will be installed in the local Maven repository.
5. How to use
If you need to use the published version of the dependencyManagement
add the following configuration.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Then add the dependencies you need to use in dependencies.
6. Version management specifications
Version number of the format of the program x.x.x
in the form in which x
the type of a digital value, from 0
the start value, is not limited to 0~9
this range. When the project is in the incubator stage, the first version number is always 0, that is, the format of the version number is 0.xx.
Because of Spring Boot 1
and Spring Boot 2
in Actuator
great changes and comments Interface module and spring-cloud-commons upgrade from version 2.0.0 to version 1.xx also have a greater change, so we take the same version number with SpringBoot version:
1.5.x 版本适用于 Spring Boot 1.5.x
2.0.x 版本适用于 Spring Boot 2.0.x
2.1.x 版本适用于 Spring Boot 2.1.x
2.2.x 版本适用于 Spring Boot 2.2.x
Spring Boot | Spring Cloud | Spring Cloud Alibaba |
---|---|---|
2.1.x | Greenwich | 0.9.x |
2.0.x | Finchley | 0.2.x |
1.5.x | Edgware | 0.1.x |
1.5.x | Dalston | 0.1.x |
7. Reference documents
Spring Cloud Alibaba 2.1.0
https://spring.io/projects/spring-cloud-alibaba#overview
Reference Doc.
https://spring-cloud-alibaba-group.github.io/github-pages/greenwich/spring-cloud-alibaba.html
Documentation
https://github.com/alibaba/spring-cloud-alibaba
Chinese document
https://github.com/alibaba/spring-cloud-alibaba/blob/master/README-zh.md
Nacos
https://nacos.io/zh-cn/docs/quick-start.html
https://github.com/alibaba/nacos/releases/tag/1.2.1
Sentinel
https://github.com/alibaba/Sentinel
8. Summary
- Spring usually refers to Spring IOC.
- The Spring Framework includes Spring IOC and Spring AOP, and integrates with other J2EE frameworks.
- Spring Boot is a supplement to the Spring Framework, making the integration of the framework easier, and is committed to rapid development of independent Spring applications.
- Spring Cloud is a set of microservice specifications designed based on Spring Boot and enhances the application context.
- Spring Cloud Alibaba uses Ali middleware as raw materials to implement Spring Cloud's microservice specifications.