[SpringCloud教程]2. 版本选型和项目搭建
Spring Cloud Alibaba 版本选型
建议先选择Spring Cloud Alibaba的大版本,方便兼容
- 选择 Spring Cloud Alibaba 大版本
访问链接,找到标题“毕业版本依赖关系(推荐使用)”,选择你想要的版本,比如图红框
由于Alibaba已经指出了最合适的版本,所以我们不去SpringCloud官网查询合适版本,直接使用Alibaba官方提供的建议即可:
- Spring Cloud Version: Spring Cloud Hoxton.SR8
- Spring Cloud Alibaba Version: 2.2.5.RELEASE
- Spring Boot Version: 2.3.2.RELEASE
Spring Cloud 版本选择(可选)
备忘用,如果需要单独使用Spring Cloud,则可参考
- 选择大版本
访问链接,拉下来找到如图所示表格,选择SpringCloud大版本(如图红框,这里选择了Hoxton),然后其右边即为对应SpringBoot版本
- 选择推荐版本
访问链接,点击"LEARN",根据你选择的大版本号点击对应的"Reference Doc."
而后即可查看到推荐版本
如果想查看指定大版本的推荐版本(可选)
直接访问 https://docs.spring.io/spring-cloud/docs/大版本号/reference/html/,如 https://docs.spring.io/spring-cloud/docs/Hoxton.SR10/reference/html/查看版本兼容范围(可选)
访问链接
微服务组件选型
注册中心
- Eureka - 停更弃用
- zookeeper
- Consul
- Nacos - 推荐
服务调用
- Ribbon
- LoadBalancer
- Feign - 弃用
- OpenFeign
服务降级
- Hystrix - 弃用
- Sentinel - 推荐
服务网关
- Zuul - 弃用
- Gateway
服务配置
- Config - 弃用
- Nacos - 推荐
服务总线
- Bus
- Nacos - 推荐
建立订单项目
以订单项目为例,演示SpringCloud和SpringCloudAlibaba的使用,代码可从此处下载
建立父项目
- 使用idea建立maven项目,删除src目录,编辑pom.xml。注意SpringCloud、SpringCloudAlibaba、SpringBoot的版本,使用前文的选择:
- Spring Cloud Version: Spring Cloud Hoxton.SR8
- Spring Cloud Alibaba Version: 2.2.5.RELEASE
- Spring Boot Version: 2.3.2.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.spz.demo</groupId>
<artifactId>spring-cloud-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- 后续新增模块后,需要在此处声明 -->
<modules>
<!-- <module>xxx</module> -->
</modules>
<!-- 统一管理jar包版本 -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
<lombok.version>1.16.18</lombok.version>
<mysql.version>8.0.16</mysql.version>
<druid.version>1.1.16</druid.version>
<mybatis.plus.version>3.3.2</mybatis.plus.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Spring Boot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Cloud Alibaba -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
[SpringCloud教程]2. 版本选型和项目搭建的更多相关文章
- SpringCloud(7)---网关概念、Zuul项目搭建
SpringCloud(7)---网关概念.Zuul项目搭建 一.网关概念 1.什么是路由网关 网关是系统的唯一对外的入口,介于客户端和服务器端之间的中间层,处理非业务功能 提供路由请求.鉴权.监控. ...
- Spring Cloud Alibaba (一): SpringCloud与SpringBoot版本选型
前言 近年SpringCloud与SpringBoot更新迭代非常频繁,导致我们对两者的版本选型非常的困难.若是版本选择有问题, 会导致开发中调试兼容性占用非常多的得必要时间. SpringClo ...
- Cocos2dx-3.0版本 从开发环境搭建(Win32)到项目移植Android平台过程详解
作为重量级的跨平台开发的游戏引擎,Cocos2d-x在现今的手游开发领域占有重要地位.那么问题来了,作为Cocos2dx的学习者,它的可移植特性我们就需要掌握,要不然总觉得少一门技能.然而这个时候各种 ...
- 最适合新手入门的SpringCloud教程 6—Ribbon负载均衡「F版本」
SpringCloud版本:Finchley.SR2 SpringBoot版本:2.0.3.RELEASE 源码地址:https://gitee.com/bingqilinpeishenme/Java ...
- SpringBoot之入门教程-SpringBoot项目搭建
SpringBoot大大的简化了Spring的配置,把Spring从配置炼狱中解救出来了,以前天天配置Spring和Mybatis,Springmvc,Hibernate等整合在一起,感觉用起来还是挺 ...
- spring-cloud项目搭建
springCloud项目搭建手册 springcloud应用场景及微服务框架发展趋势 Spring Cloud为开发人员提供了工具,以快速构建分布式系统中的某些常见模式(例如,配置管理,服务发现,断 ...
- SpringCloud(六)之 网关概念、Zuul项目搭建-(利用Zuul 实现鉴权和限流实战)
一.网关概念 1.什么是路由网关 网关是系统的唯一对外的入口,介于客户端和服务器端之间的中间层,处理非业务功能 提供路由请求.鉴权.监控.缓存.限流等功能.它将"1对N"问题转换成 ...
- Angular入门到精通系列教程(4)- 开发环境搭建以及入手项目
1. 本地开发环境搭建 1.1. node.js 1.2. Angular CLI 2. 开发工具 - Visual Studio Code 第一个Anuglar项目 创建第一个anuglar项目 A ...
- 《Asp.Net Core3 + Vue3入坑教程》-Net Core项目搭建与Swagger配置步骤
简介 <Asp.Net Core3 + Vue3入坑教程> 此教程仅适合新手入门或者前后端分离尝试者.可以根据图文一步一步进操作编码也可以选择直接查看源码.每一篇文章都有对应的源码 教程后 ...
随机推荐
- Visual Studio Online & Web 版 VS Code
Visual Studio Online & Web 版 VS Code https://online.visualstudio.com https://devblogs.microsoft. ...
- Linux & terminal color & command line color
Linux & terminal color & command line color how to change Linux terminal color https://askub ...
- React & redux-saga & effects & Generator function & React Hooks
React & redux-saga & effects & Generator function & React Hooks demos https://github ...
- js bese64转化为blob使用FormData上传
原文 工作示例 <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
- SpringBoot+Vue豆宝社区前后端分离项目手把手实战系列教程01---搭建前端工程
豆宝社区项目实战教程简介 本项目实战教程配有免费视频教程,配套代码完全开源.手把手从零开始搭建一个目前应用最广泛的Springboot+Vue前后端分离多用户社区项目.本项目难度适中,为便于大家学习, ...
- Java开发的得力助手---Guava
导语 guava是google出品的java类库,被google广泛用于内部项目,该类库经过google大牛们的千锤百炼,以优雅的设计在java世界流行.版本迭代至今,很多思想甚至被JDK标准库借鉴, ...
- Why GraphQL? 6个问题
Why GraphQL? 6个问题 GraphQL, 是一个API的标准: specification. 对于每个新技术, 要搞清楚的6个问题: 1.这个技术出现的背景, 初衷, 要达到什么样的目标或 ...
- docker仓库之harbor高可用 (三)
基于上一篇部署完成了企业级仓库harbor的部署,今天我们来聊聊什么是harbor的高可用 Harbor 支持基于策略的 Docker 镜像复制功能,这类似于 MySQL 的主从同步,其可以实现不同的 ...
- (数据科学学习手札109)Python+Dash快速web应用开发——静态部件篇(中)
本文示例代码已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 这是我的系列教程Python+Dash快速web ...
- 从零开始搞后台管理系统(2)——shin-server
shin 的读音是[ʃɪn],谐音就是行,寓意可行的后端系统服务,shin-server 的特点是: 站在巨人的肩膀上,依托KOA2.bunyan.Sequelize等优秀的框架和库所搭建的定制化 ...