前言
要求
本节详细介绍了兼容的 Java 和 Spring Framework 版本。
代码约定
Spring Framework 2.0 引入了对命名空间的支持,这简化了应用程序上下文的 XML 配置,并让 Spring Integration 提供了广泛的命名空间支持。
在本参考指南中,int
命名空间前缀用于 Spring Integration 的核心命名空间支持。
每种 Spring Integration 适配器类型(也称为模块)都提供自己的命名空间,其配置遵循以下约定:
以下示例展示了 int
、int-event
和 int-stream
命名空间的使用:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-webflux="http://www.springframework.org/schema/integration/webflux"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/webflux
https://www.springframework.org/schema/integration/webflux/spring-integration-webflux.xsd
http://www.springframework.org/schema/integration/stream
https://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd">
…
</beans>
有关 Spring Integration 命名空间支持的详细说明,请参阅 命名空间支持。
命名空间前缀可以自由选择。 您甚至可以选择根本不使用任何命名空间前缀。 因此,您应该应用最适合您应用程序的约定。 但请注意,SpringSource Tool Suite™ (STS) 对 Spring Integration 使用的命名空间约定与本参考指南中使用的相同。 |
本指南中的约定
在某些情况下,为了在指定长完全限定类名时帮助格式化,我们将 org.springframework
缩写为 o.s
,将 org.springframework.integration
缩写为 o.s.i
,例如 o.s.i.transaction.TransactionSynchronizationFactory
。
反馈和贡献
对于操作方法问题或诊断或调试问题,我们建议使用 Stack Overflow。 点击 此处 查看最新问题列表。 如果您非常确定 Spring Integration 中存在问题或想提出功能建议,请使用 GitHub Issues。
如果您有解决方案或建议的修复程序,可以在 GitHub 上提交拉取请求。 但是,请记住,除了最简单的问题之外,我们都希望在问题跟踪器中提交工单,在那里进行讨论并为将来参考留下记录。
有关更多详细信息,请参阅 CONTRIBUTING 顶级项目页面上的指南。
入门
如果您刚开始使用 Spring Integration,您可能希望从创建基于 Spring Boot 的应用程序开始。 Spring Boot 提供了一种快速(且有主见)的方式来创建生产就绪的基于 Spring 的应用程序。 它基于 Spring Framework,倾向于约定优于配置,旨在让您尽快启动和运行。
您可以使用 start.spring.io 生成一个基本项目(添加 integration
作为依赖项)或遵循其中一个 "入门"指南,例如 入门构建集成数据。
除了更容易理解之外,这些指南还非常注重任务,并且大多数都基于 Spring Boot。