spring-framework
spring-framework copied to clipboard
Add @Sql equivalent support to R2DBC
@Sql annotation is from jdbc package (org.springframework.test.context.jdbc). Could you please make it more general (from jdbc & r2dbc perspective) so that one can do like this:
@DataR2dbcTest
@Sql("scripts/normalize-sheet.sql")
Right now it gives this exception:
...
java.lang.IllegalStateException: Failed to execute SQL scripts for test context [DefaultTestContext@32a13034 testClass
...
contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]: supply at least a DataSource or PlatformTransactionManager.
At the moment one of the workarounds is manual script execution: https://stackoverflow.com/a/64118434/4456087
@sbrannen is that something worth considering in spring-test?
@sbrannen is that something worth considering in
spring-test?
Yes, I think so.
And as you pointed out, spring-projects/spring-data-r2dbc#313 is related.
Closing in favor of #34350