#概述
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, short lived microservices and contract testing). 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 为开发者提供了工具,用于快速构建分布式系统中的常见模式。(例如:配置管理、服务发现、断路器、智能路由、微代理、控制总线、短寿命微服务和契约测试)。分布式系统的协调会形成固定模式,而借助Spring Cloud,开发者能够快速构建实现这些模式的服务与应用程序。它们在任何分布式环境中都能良好运行,包括开发者自己的笔记本电脑、裸机数据中心以及Cloud Foundry等托管平台。
#功能
Spring Cloud focuses on providing good out of box experience for typical use cases and extensibility mechanism to cover others.
Spring Cloud 致力于为典型用例提供良好的开箱即用体验,并通过可扩展机制覆盖其他场景。
Distributed/versioned configuration
分布式配置管理
Service registration and discovery
服务注册与发现
Routing
网关路由
Service-to-service calls
服务间调用
Load balancing
负载均衡
Circuit Breakers
断路器
Distributed messaging
分布式消息
Short lived microservices (tasks)
Consumer-driven and producer-driven contract testing
#入门指南
The easiest way to get started is visit start.spring.io, select your Spring Boot version and the Spring Cloud projects you want to use. This will add the corresponding Spring Cloud BOM version to your Maven/Gradle file when you generate the project.
最简便的入门方式是访问 start.spring.io,选择所需的 Spring Boot 版本及 Spring Cloud 项目。生成项目时,系统将自动为您的 Maven/Gradle 文件添加对应的 Spring Cloud BOM 版本。
If you an existing Spring Boot app you want to add Spring Cloud to that app, the first step is to determine the version of Spring Cloud you should use. The version you use in your app will depend on the version of Spring Boot you are using.
若您希望在现有 Spring Boot 应用中添加 Spring Cloud,第一步是确定应使用的 Spring Cloud 版本。应用中使用的版本取决于您当前使用的 Spring Boot 版本。

Bug fixes and backwards compatible features are added to each release train via a service release (SR).Once you determine which version of Spring Cloud to use, you should use the latest service release for that release train.
每个发布 train via 服务版本(SR)添加错误修复和向后兼容功能。一旦确定使用哪个版本的Spring Cloud,就应采用该版本发布train中的最新服务版本。
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.0'
id 'io.spring.dependency-management' version '1.1.7'
}
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "2025.1.0")
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
Just like Spring Boot, many Spring Cloud projects include starters that you can add as dependencies to add various cloud native features to your project. In many cases, many features are enabled purely by adding the starter to your classpath.The starter names are documented within the individual projects.Below is an example of how you would add a Spring Cloud Config Client and a Spring Cloud Netflix Eureka client to your application.
与 Spring Boot 类似,许多 Spring Cloud 项目都包含 starter 组件,你可以将其添加为依赖项,从而为项目增添各种云原生功能。在许多情况下,仅需将启动器添加到类路径中,即可启用众多功能。启动程序的名称在各个项目中都有记录。以下是一个示例,展示如何在应用程序中添加 Spring Cloud Config 客户端和 Spring Cloud Netflix Eureka 客户端。
主要项目
Spring Cloud Config
Centralized external configuration management backed by a git repository. The configuration resources map directly to Spring Environment but could be used by non-Spring applications if desired.
基于Git仓库的集中式外部配置管理。配置资源直接映射至Spring环境,但也可根据需要用于非Spring应用程序。
Spring Cloud Gateway
Spring Cloud Gateway is an intelligent and programmable router based on Spring Framework and Spring Boot.
Spring Cloud Gateway 是一款基于 Spring 框架和 Spring Boot 的智能可编程路由器。
Spring Cloud Netflix
Integration with Eureka Services Discovery from Netflix OSS.
与Netflix开源软件库(OSS)的Eureka服务发现集成。
Spring Cloud Consul
Service discovery and configuration management with Hashicorp Consul.
使用Hashicorp Consul实现服务发现与配置管理。
Spring Cloud Kubernetes
Kubernetes integration with Spring Cloud Discovery Client, Configuration, including Controllers for Discovery and Configuration.
Kubernetes 与 Spring Cloud Discovery Client、Configuration 的集成,包括用于服务发现和配置的控制器。
Spring Cloud Function
Spring Cloud Function promotes the implementation of business logic via functions. It supports a uniform programming model across serverless providers, as well as the ability to run standalone (locally or in a PaaS).
Spring Cloud Function 通过函数实现业务逻辑的部署。它支持跨无服务器提供商的统一编程模型,并具备独立运行能力(可在本地或PaaS环境中运行)。
Spring Cloud Stream
A lightweight event-driven microservices framework to quickly build applications that can connect to external systems. Simple declarative model to send and receive messages using Apache Kafka or RabbitMQ between Spring Boot apps.
一个轻量级的事件驱动微服务框架,用于快速构建能够连接外部系统的应用程序。通过简单的声明式模型,可在Spring Boot应用之间使用Apache Kafka或RabbitMQ发送和接收消息。
Spring Cloud Stream Applications
Spring Cloud Stream Applications are out of the box Spring Boot applications providing integration with external middleware systems such as Apache Kafka, RabbitMQ etc. using the binder abstraction in Spring Cloud Stream.
Spring Cloud Stream 应用程序是开箱即用的 Spring Boot 应用程序,通过 Spring Cloud Stream 中的绑定器抽象层,可与 Apache Kafka、RabbitMQ 等外部中间件系统实现集成。
Spring Cloud Task
A short-lived microservices framework to quickly build applications that perform finite amounts of data processing. Simple declarative for adding both functional and non-functional features to Spring Boot apps.
一个短暂存在的微服务框架,用于快速构建执行有限数据处理的应用程序。通过简单的声明式方式,为Spring Boot应用添加功能性与非功能性特性。
Spring Cloud Task App Starters
Spring Cloud Task App Starters are Spring Boot applications that may be any process including Spring Batch jobs that do not run forever, and they end/stop after a finite period of data processing.
Spring Cloud Task 应用启动器是 Spring Boot 应用程序,可以是任何进程(包括 Spring Batch 作业),这些进程并非永久运行,而是在有限的数据处理周期后终止/停止。
Spring Cloud Zookeeper
Service discovery and configuration management with Apache Zookeeper.
基于Apache Zookeeper的服务发现与配置管理。
Spring Cloud Contract
Spring Cloud Contract is an umbrella project holding solutions that help users in successfully implementing the Consumer Driven Contracts approach.
Spring Cloud Contract 是一个伞式项目,其下汇集了多种解决方案,旨在帮助用户成功实施消费者驱动契约方法。
Spring Cloud OpenFeign
Spring Cloud OpenFeign provides integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.
Spring Cloud OpenFeign通过自动配置与Spring环境及其他Spring编程模式惯例的绑定,为Spring Boot应用提供集成支持。
Spring Cloud Bus
An event bus for linking services and service instances together with distributed messaging. Useful for propagating state changes across a cluster (e.g. config change events).
用于通过分布式消息传递将服务与服务实例连接起来的事务总线。适用于在集群中传播状态变更(例如配置变更事件)。
Spring Cloud Open Service Broker
Provides a starting point for building a service broker that implements the Open Service Broker API.
为构建实现开放服务代理API的服务代理提供了起点。
Release Trains
Spring Cloud is an umbrella project consisting of independent projects with, in principle, different release cadences. To manage the portfolio a BOM (Bill of Materials) is published with a curated set of dependencies on the individual project. Go here to read about the Release Train naming conventions.