When upgraded to Spring Boot 3.3.1(from the build log, Spring Boot 3.3.0 worked), I got an exception when running PostRepositoryTest in my Spring Boot neo4j example which demos using Neo4j reactive template.
Check the build stack here: https://github.com/hantsy/spring-reactive-sample/actions/runs/9722916730/job/26837408667
java.lang.NullPointerException: Cannot invoke "org.springframework.transaction.reactive.TransactionalOperator.transactional
(reactor.core.publisher.Mono)" because "this.transactionalOperator" is null
Comment From: wilkinsona
I suspect this is due to #40953, the forward port of #40895. Can you please try defining a ReactiveNeo4jTransactionManager bean and see if that helps?
Comment From: hantsy
Add a ReactiveNeo4jTransactionManager bean, and got new exception like this.
java.lang.IllegalStateException: Failed to retrieve PlatformTransactionManager
for @Transactional test: [DefaultTestContext@54463380 testClass = com.example.demo.PostRepositoryTest,
Comment From: hantsy
I have to define a ReactiveNeo4jTransactionManager bean and add @Transactional(NOT_SUPPORTED) on the tests to get the test passed(I have no sense of this).
Comment From: hantsy
I suspect this is due to #40953, the forward port of #40895. Can you please try defining a
ReactiveNeo4jTransactionManagerbean and see if that helps?
In the commit, the ReactiveNeo4jTransactionManager bean definition is removed.
I do not use @Transactional explicitly in my codes, the error is from reactive neo4j template I used here.
Comment From: wilkinsona
Please see the javadoc for @DataNeo4jTest where it says:
By default, tests annotated with
@DataNeo4jTestare transactional with the usual test-related semantics (i.e. rollback by default). This feature is not supported with reactive access so this should be disabled by annotating the test class with@Transactional(propagation = Propagation.NOT_SUPPORTED)
This note has been there since Spring Boot 2.4 and was added in https://github.com/spring-projects/spring-boot/issues/23630. I believe it's still relevant as https://github.com/spring-projects/spring-framework/issues/24226 to which it links is still open.
I suspect that this wasn't actually working properly in 3.3.0, it just wasn't throwing an exception to make the error obvious.
Comment From: hantsy
I suspect that this wasn't actually working properly in 3.3.0, it just wasn't throwing an exception to make the error obvious.
I am not sure about this. Originally my testing codes were annotated with a @Transactional(propagation = Propagation.NOT_SUPPORTED), but it was commented out at some time.
Comment From: wilkinsona
Sorry, I'm not sure I understand.
Annotating the test with @Transactional(propagation = Propagation.NOT_SUPPORTED) is what's documented and recommended. If a failure didn't occur when it was commented out then my suspicion is that it still wasn't actually working properly, but it wasn't throwing an exception so it wasn't obvious. You certainly wouldn't have got the transaction management that you may have expected as there's no such support when using a reactive transaction manager.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.