spring-framework / org.springframework.test.context.jdbc / Sql / scripts

scripts

@AliasFor("value") val scripts: Array<String>

The paths to the SQL scripts to execute.

This attribute may not be used in conjunction with #value, but it may be used instead of #value. Similarly, this attribute may be used in conjunction with or instead of #statements.

Path Resource Semantics

Each path will be interpreted as a Spring org.springframework.core.io.Resource. A plain path — for example, "schema.sql" — will be treated as a classpath resource that is relative to the package in which the test class is defined. A path starting with a slash will be treated as an absolute classpath resource, for example: "/org/example/schema.sql". A path which references a URL (e.g., a path prefixed with classpath:, file:, http:, etc.) will be loaded using the specified resource protocol.

Default Script Detection

If no SQL scripts or #statements are specified, an attempt will be made to detect a default script depending on where this annotation is declared. If a default cannot be detected, an IllegalStateException will be thrown.

See Also
#value#statements