spring-data-jpaspring-webfluxjtaspring-data-r2dbcr2dbc

@Trasactional annotation not working with webflux 3.3.2


We have recently started upgrading spring webflux version 2.7X to 3.3.2. After this upgrade, when we hit API with Postman it goes to controller layer and if service layer method is annotated with @Transactional, it does not reach to service layer. Further we got Error: socket hang up

But none of this found to be working. We found this question as well from where only we tried #1. Please suggest what could be wrong here.

We tried to debug by enabling org.springframework.transaction level to DEBUG but no luck Further, to solve the issue, we have tried:

  1. JTA @Transactional from "jakarta.transaction.Transactional" [latest version 2.0.1]
  2. transactionalOperator from "org.springframework.transaction.reactive.TransactionalOperator"
  3. Creating bean of transactionManager from "org.springframework.r2dbc.connection.R2dbcTransactionManager".

Solution

  • We have two dependencies in our POM file.

        <dependency>
            <groupId>io.r2dbc</groupId>
            <artifactId>r2dbc-postgresql</artifactId>
            <version>0.8.12.RELEASE</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>r2dbc-postgresql</artifactId>
            <version>1.0.0.RELEASE</version>
        </dependency>
    

    then We removed "io.r2dbc" dependency and it worked. But could not understand why it was working before upgrading version.