首页 > 解决方案 > 使用 Spring Data Neo4j 的 Spring Web Flux 项目是否有事务支持(TransactionalOperator)?

问题描述

我尝试TransactionalOperator在以下组件中使用:

@Component
class OrganisationHandler(
    private val repository: OrganisationRepository,
    private val operator: TransactionalOperator
) { ... }

启动应用程序会导致以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 1 of constructor in com.keen.backend.organisation.OrganisationHandler required a bean of type 'org.springframework.transaction.reactive.TransactionalOperator' that could not be found.

The following candidates were found but could not be injected:
    - Bean method 'transactionalOperator' in 'TransactionAutoConfiguration' not loaded because @ConditionalOnSingleCandidate (types: org.springframework.transaction.ReactiveTransactionManager; SearchStrategy: all) did not find any beans


Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.transaction.reactive.TransactionalOperator' in your configuration.

将此文档用作参考。我还偶然发现了一年前的这篇博文。似乎没有任何 SDN 实现AbstractReactiveTransactionManager可以与TransactionalOperator#create(ReactiveTransactionManager). 我也找不到有关该功能的任何相关票证。

在 Web Flux 环境中是否有解决方法或可能有不同的方法来处理 SDN 的事务?

标签: kotlinspring-webfluxspring-transactionsspring-data-neo4j

解决方案


推荐阅读