In Spring data JPA there is an @Sql
annotation which is very handy for setting up integration tests for persistence layer. It can roll out test data before each test and perform a clean up after it.
However, I could not find it in spring-data-r2dbc
module. Is there anything similar to easily handle this task in spring-data-r2dbc
?
For now I haven't found anything better than using
org.springframework.data.r2dbc.connectionfactory.init.ScriptUtils#executeSqlScript(io.r2dbc.spi.Connection, org.springframework.core.io.Resource)
together with JUnit@BeforeEach
and@AfterEach
test callbacks:NB: here I am using JUnit5 with jupiter API