# spring-cloud-simple **Repository Path**: fuckjava/spring-cloud-simple ## Basic Information - **Project Name**: spring-cloud-simple - **Description**: spring-cloud 简单实战项目 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-28 - **Last Updated**: 2021-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring-cloud-simple #### 介绍 spring-cloud 简单实战项目 ## 单体应用和微服务 ### 单体应用的缺点 1. 部署慢、部署频率低 2. 无法按需拓展 3. 阻碍技术创新 ### 微服务的特性 >微服务架构风格是将一种将一个单一应用程序开发为一组小型服务的方法,每个服务运行在自己的进程中,服务间通信采用轻量级通信机制(通常用HTTP资源API)。这些服务围绕业务能力构建并且可通过全自动部署机制独立部署。这些服务共用一个最小型的集中式的管理,服务可用不同的语言开发,使用不同的数据存储技术 1. 每个微服务可独立运行在自己的进程中 2. 一系列独立运行的微服务共同构建起整个系统 3. 每个微服务为独立的业务开发,只关注某个特定的功能 4. 全自动机制(CI/CD) 5. 异构(不同语言与数据存储) 6. 轻量的通信机制 **核心思想:分而治之** ## 微服务架构通览 ![82be7831b7d84ff8b61c2e6610eae9fb.png](en-resource://database/3797:0) ### 微服务适用场景 * 大型复杂应用 * 高并发、高负载应用 * 快速迭代 ## 微服务拆分方法 * Domain Driven Design (DDD) 上手难度高的微服务拆分方法 * 面向对象 * By name. * By verb. ### 微服务拆分心得 * 按照职责划分 * 按照通用性划分 ### 微服务粒度 * 良好地满足业务需求 * 增量迭代 * 持续进化(技术更替) * 幸福感 ## 项目介绍与微服务拆分 ![191d1e6cc120a27a8d3cb9b7c7979776.png](en-resource://database/3799:0) ## 项目架构图和数据模型 ![448c6bfd95830d57a76883da24f4fbd1.png](en-resource://database/3801:0) ## 技术选型 * Spring boot * Spring MVC * Spring Data JPA * Spring Cloud ### 编写用户微服务 ## 总结 ## Srping Cloud是什么? * 快速开发分布式应用的工具集 * https://spring.io/projects/spring-cloud | 功能 |翻译 |选择 | | --- | --- | --- | | Distributed/versioned configuration | 分布式/版本化的配置管理 | Spring Cloud Config、Consul、Zookeeper、Nacos | | service registration and discovery | 服务注册与服务发现 | Eureka、Consul、Zookeeper、Nacos| | Routing |路由 |Zuul、Spring Cloud Gateway | | Service-to-service calls |端到端的调用 |RestTemplate、Feign | | Load balancing |负载均衡 | Ribbon | | Circuit Breakers |断路器 | Hystrix、Resilience4J、Sentinel | | Global locks | 全局锁| Spring Cloud Cluster(已潜移到Spring integration ) | | Leadership election and cluster state |选举与集群状态管理 | Spring Cloud Cluster(已潜移到Spring integration ) | | Distributed messageing | 分布式消息 | Spring Cloud Stream+kafka/RabbitMQ/RocketMQ | ### 常用子项目 ## 版本与兼容性 ### Spring cloud 版本命名 * 版本顺序 * 伦敦地铁站路线图 * https://t.itmuch.com/london-rail-map.pdf * 指定版本的发布流程 * SNAPSHOT->Mx->RELEASE-SRx ### Spring Cloud生命周期 * 版本发布规划 * https://github.com/spring-cloud/spring-cloud-release/milestones * 版本发布记录 * https://github.com/spring-cloud/spring-cloud-release/releases * 版本终止声明 * https://spring.io/projects/spring-cloud#overview ### 版本兼容性 | Spring Cloud版本 |Spring Boot版本 | | --- | --- | | Hoxton | 2.2.x| | Greenwich | 2.1.x | | Finchley | 2.0.x | | Edgware | 1.5.x | |Dalston | 1.5.x | * 兼容性查询 * https://spring.io/projects/spring-cloud ### 生产环境如何选择版本 * 坚决不用非稳定版本/end-of-life版本 * 尽量用最新一代 * xxx.RELEASE版本可以观望/调研一下 * SR之后一般可以大规模使用 ### 整合Spring Cloud * 版本选择 * Spring Cloud Hoxton.M2 * Spring Boot 2.2.0.M5