# 10.6. Spring Integration

Spring Boot 为使用[Spring Integration](https://spring.io/projects/spring-integration)提供了多种便利，包括`spring-boot-starter-integration`“Starter”。Spring Integration 提供了对消息传递以及其他传输（例如 HTTP、TCP 等）的抽象。如果 Spring Integration 在您的类路径上可用，它将通过`@EnableIntegration`注释进行初始化。

Spring Integration 轮询逻辑依赖[于自动配置的`TaskScheduler`](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.task-execution-and-scheduling). `PollerMetadata`默认值（每秒轮询无限数量的消息）可以使用`spring.integration.poller.*`配置属性进行自定义。

Spring Boot 还配置了一些由其他 Spring Integration 模块的存在触发的功能。如果`spring-integration-jmx`也在类路径上，则消息处理统计信息将通过 JMX 发布。如果`spring-integration-jdbc`可用，则可以在启动时创建默认数据库架构，如下行所示：

```
spring.integration.jdbc.initialize-schema=always
```

如果`spring-integration-rsocket`可用，开发人员可以使用`"spring.rsocket.server.*"`属性配置 RSocket 服务器，并让它使用`IntegrationRSocketEndpoint`或`RSocketOutboundGateway`组件来处理传入的 RSocket 消息。该基础设施可以处理 Spring Integration RSocket 通道适配器和`@MessageMapping`处理程序（已给定`"spring.integration.rsocket.server.message-mapping-enabled"`配置）。

Spring Boot 还可以使用配置属性自动配置`ClientRSocketConnector`：

```
# Connecting to a RSocket server over TCP
spring.integration.rsocket.client.host=example.org
spring.integration.rsocket.client.port=9898
```

```
# Connecting to a RSocket Server over WebSocket
spring.integration.rsocket.client.uri=ws://example.org
```

有关更多详细信息，请参阅[`IntegrationAutoConfiguration`](https://github.com/spring-projects/spring-boot/tree/v3.2.0/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java)和[`IntegrationProperties`](https://github.com/spring-projects/spring-boot/tree/v3.2.0/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationProperties.java)类。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.shiker.tech/spring-boot-can-kao-wen-dang/10.-xiao-xi/10.6.-spring-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
