【发布时间】:2019-12-04 09:49:53
【问题描述】:
我正在尝试使用 spring integrations jpa-inbound-channel-adapter 从数据库中获取记录并对它们执行一组操作。我还需要确保我的并发运行的实例在任何给定时间点都不会多次获得相同的记录。
我查看了以下文档,了解如何配置 jpa-inbound-channel-adapter 来处理事务,
<int-jpa:inbound-channel-adapter
channel="inboundChannelAdapterOne"
entity-manager="em"
auto-startup="true"
jpa-query="select s from Student s"
expect-single-result="true"
delete-after-poll="true">
<int:poller fixed-rate="2000" >
<int:transactional propagation="REQUIRED"
transaction-manager="transactionManager"/>
</int:poller>
</int-jpa:inbound-channel-adapter>
我还没有找到任何方法可以在 Spring Boot 应用程序中实现 Java 配置(没有 xml 配置)。我可以看到 Java 配置示例,但没有一个是事务性的。任何指针都会有所帮助。
【问题讨论】:
标签: java spring-boot spring-data-jpa spring-integration