如需使用最新稳定版本,请使用 Spring Integration 7.0.4spring-doc.cadn.net.cn

JPA 支持

Spring Integration 的 JPA(Java Persistence API)模块提供了用于使用 JPA 执行各种数据库操作的组件。spring-doc.cadn.net.cn

您需要将以下依赖项包含到您的项目中:spring-doc.cadn.net.cn

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-jpa</artifactId>
    <version>6.4.10</version>
</dependency>
compile "org.springframework.integration:spring-integration-jpa:6.4.10"

JPA API 必须通过某些特定提供商的实现来包含,例如 Hibernate ORM 框架。spring-doc.cadn.net.cn

以下组件已提供:spring-doc.cadn.net.cn

这些组件可用于通过向目标数据库发送和接收消息,对它们执行selectcreateupdatedelete操作。spring-doc.cadn.net.cn

JPA 入站通道适配器允许您使用 JPA 从数据库轮询并检索 (select) 数据,而 JPA 出站通道适配器则允许您创建、更新和删除实体。spring-doc.cadn.net.cn

您可以使用 JPA 的出站网关将实体持久化到数据库,从而让您继续流程并执行下游的更多组件。 同样,您也可以使用出站网关从数据库中检索实体。spring-doc.cadn.net.cn

例如,您可以使用出站网关,该网关在其请求通道上接收带有 MessageuserId 作为有效负载的消息,以查询数据库、检索用户实体,并将其传递给下游进行进一步处理。spring-doc.cadn.net.cn

认识到这些语义差异,Spring Integration 提供了两个独立的 JPA 出站网关:spring-doc.cadn.net.cn