01.Spring Cloud Alibab简介及初始环境搭建

Posted 潮汐先生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了01.Spring Cloud Alibab简介及初始环境搭建相关的知识,希望对你有一定的参考价值。

Spring Cloud Alibaba简介

Spring Cloud Alibaba provides a one-stop solution for distributed application development. It contains all the components required to develop distributed applications, making it easy for you to develop your applications using Spring Cloud. – 摘自官网

译文:Spring Cloud Alibaba是阿里巴巴为分布式应用开发提供一站式解决方案。它包含了开发分布式应用程序所需的所有组件,使您可以轻松地使用Spring Cloud开发应用程序。

Spring Cloud Alibaba组件

  • Flow control and service degradation:flow control, circuit breaking and system adaptive protection with Alibaba Sentinel
  • Service registration and discovery:instances can be registered with Alibaba Nacos and clients can discover the instances using Spring-managed beans. Supports Ribbon, the client side load-balancer via Spring Cloud Netflix
  • Distributed Configuration:using Alibaba Nacos as a data store
  • Event-driven:building highly scalable event-driven microservices connected with Spring Cloud Stream RocketMQ Binder
  • Message Bus: link nodes of a distributed system with Spring Cloud Bus RocketMQ
  • Distributed Transaction:support for distributed transaction solution with high performance and ease of use with Seata
  • Dubbo RPC:extend the communication protocols of Spring Cloud service-to-service calls by Apache Dubbo RPC
Spring Cloud组件组件的作用及描述Spring Cloud Alibaba组件
Eureka | consul服务注册与发现Nacos
RestTemplate OpenFeign服务间通信Dubbo RPC
Hystrix服务降级、熔断Sentinel
Bus事件驱动RocketMQ
消息总线(异步处理)Message Bus
分布式事务Seata
Config统一配置中心Nacos

实际开发中,我们是SpringCloud与SpringCloudAlibaba混合使用的。

  • 服务注册中心 ---------- Nacos
  • 服务间通信与负载均衡 ---------- HttpRest(a:RestTemplate+Ribbon b: OpenFeign)
  • 服务流控与服务降级 ---------- Sentinel
  • 服务网关组件 ---------- Gateway
  • 统一配置中心 ---------- Nacos

初始环境搭建

1.新建Module

2.pom.xml

这里我们使用的SpringBoot版本是2.2.5.RELEASE、SpringCloud版本是Hoxton.SR6、SpringCloud alibaba的版本是最新的2.2.1.RELEASE

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.christy</groupId>
    <artifactId>springcloud_alibaba_parent</artifactId>
    <version>1.0-SNAPSHOT</version>

    <!--继承springboot父项目-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.5.RELEASE</version>
    </parent>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>

        <spring.cloud.version>Hoxton.SR6</spring.cloud.version>
        <spring.cloud.alibaba.version>2.2.1.RELEASE</spring.cloud.alibaba.version>
    </properties>

    <!--维护依赖-->
    <dependencyManagement>
        <dependencies>
            <!--维护springcloud-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring.cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!--维护springcloud alibaba-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>${spring.cloud.alibaba.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>

    </dependencyManagement>
</project>

springcloud_alibaba_parent作为全局的父项目我们就搭建完毕了,下一接我们从服务注册与发现(Nacos)学起。ヾ(◍°∇°◍)ノ゙

本系列专题源码已经上传至gitee:https://gitee.com/tide001/springcloud_parent,欢迎下载交流

以上是关于01.Spring Cloud Alibab简介及初始环境搭建的主要内容,如果未能解决你的问题,请参考以下文章

spring cloud 与 spring boot 和 spring cloud alibab 版本号对应

spring cloud alibab nacos:nacos作为注册中心如何使用

Spring4- 01 - Spring框架简介及官方压缩包目录介绍- Spring IoC 的概念 - Spring hello world环境搭建

01---Spring框架

38. docker cloud 简介及 关联 git hub

Spring cloud简介及Netflix组件介绍?