Register runtime hints for @Sql scripts

SqlScriptsTestExecutionListener now implements AotTestExecutionListener
in order to register run-time hints for SQL scripts used by test
classes and test methods annotated with @Sql if the configured or
detected SQL scripts are classpath resources.

Closes gh-29027
This commit is contained in:
Sam Brannen
2022-09-05 14:15:15 +02:00
parent e85e769f1c
commit e57b5f1dfc
2 changed files with 61 additions and 14 deletions

View File

@@ -191,6 +191,12 @@ class TestContextAotGeneratorTests extends AbstractAotTests {
// @WebAppConfiguration(value = ...)
assertThat(resource().forResource("/META-INF/web-resources/resources/Spring.js")).accepts(runtimeHints);
assertThat(resource().forResource("/META-INF/web-resources/WEB-INF/views/home.jsp")).accepts(runtimeHints);
// @Sql(scripts = ...)
assertThat(resource().forResource("/org/springframework/test/context/jdbc/schema.sql"))
.accepts(runtimeHints);
assertThat(resource().forResource("/org/springframework/test/context/aot/samples/jdbc/SqlScriptsSpringJupiterTests.test.sql"))
.accepts(runtimeHints);
}
private static void assertReflectionRegistered(RuntimeHints runtimeHints, String type, MemberCategory memberCategory) {