Skip to content

Commit ff52486

Browse files
DATAGRAPH-1401 - Adapt to reverted [At]Transactional behaviour.
See: spring-projects/spring-boot@a5b2778.
1 parent 9765b13 commit ff52486

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/main/asciidoc/testing/testing.adoc

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,13 @@ The test slice provides all the necessary infrastructure for tests using Neo4j:
7878
depending on reactive dependencies present or not.
7979
The test slice already includes `@ExtendWith(SpringExtension.class)` so that it runs automatically with JUnit 5 (JUnit Jupiter).
8080

81-
`@DataNeo4jTest` provides both imperative and reactive infrastructure by default.
82-
It does *not* make your test `@Transactional` however.
83-
84-
`@Transactional` in Spring tests however always means imperative transactional,
85-
as declarative transactions needs the return type of a method to decide whether the imperative `PlatformTransactionManager`
86-
or the reactive `ReactiveTransactionManager` is needed. Testmethods however don't return anything and neither the
87-
Spring Framework itself, the testing framework or Spring Data Neo4j can decide this in a reliable way for the user.
88-
89-
IMPORTANT: Make sure to add `@Transactional` to your test class in case you want to test imperative transactions
90-
that should be automatically rolled back after the test.
91-
To assert the correct transactional behaviour for reactive repositories or services, you will need to
92-
inject a `TransactionalOperator` into the test or wrap your domain logic in services that use annotated
93-
methods exposing a return type that makes it possible for the infrastructure to select the correct
94-
transaction manager.
81+
`@DataNeo4jTest` provides both imperative and reactive infrastructure by default and also adds an implicit `@Transactional` as well.
82+
`@Transactional` in Spring tests however always means imperative transactional, as declarative transactions needs the
83+
return type of a method to decide whether the imperative `PlatformTransactionManager` or the reactive `ReactiveTransactionManager` is needed.
9584

85+
To assert the correct transactional behaviour for reactive repositories or services, you will need to inject a `TransactionalOperator`
86+
into the test or wrap your domain logic in services that use annotated methods exposing a return type that makes it possible
87+
for the infrastructure to select the correct transaction manager.
9688

9789
The test slice does not bring in an embedded database or any other connection setting.
9890
It is up to you to use an appropriate connection.

0 commit comments

Comments
 (0)