Binder Detection

Spring Cloud Stream 依靠 Binder SPI 的实现来连接(绑定)用户代码到消息代理。每个 binder 实现通常连接到一种类型的消息传递系统。

Spring Cloud Stream relies on implementations of the Binder SPI to perform the task of connecting (binding) user code to message brokers. Each Binder implementation typically connects to one type of messaging system.

Classpath Detection

默认情况下,Spring Cloud Stream 依靠 Spring Boot 的自动配置来配置绑定过程。如果在类路径中找到单个 Binder 实现,Spring Cloud Stream 会自动使用它。例如,仅绑定到 RabbitMQ 的 Spring Cloud Stream 项目可以添加以下依赖关系:

By default, Spring Cloud Stream relies on Spring Boot’s auto-configuration to configure the binding process. If a single Binder implementation is found on the classpath, Spring Cloud Stream automatically uses it. For example, a Spring Cloud Stream project that aims to bind only to RabbitMQ can add the following dependency:

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>

有关其他 binder 依赖关系的具体 Maven 坐标,请参阅该 binder 实现的文档。

For the specific Maven coordinates of other binder dependencies, see the documentation of that binder implementation.