对于最新的稳定版本,请使用 Spring Framework 6.2.0! |
@SqlConfig
@SqlConfig
定义用于确定如何解析和运行 SQL 脚本的元数据
配置了@Sql
注解。以下示例演示如何使用它:
-
Java
-
Kotlin
@Test
@Sql(
scripts = "/test-user-data.sql",
config = @SqlConfig(commentPrefix = "`", separator = "@@") (1)
)
void userTest() {
// run code that relies on the test data
}
1 | 在 SQL 脚本中设置注释前缀和分隔符。 |
@Test
@Sql("/test-user-data.sql", config = SqlConfig(commentPrefix = "`", separator = "@@")) (1)
fun userTest() {
// run code that relies on the test data
}
1 | 在 SQL 脚本中设置注释前缀和分隔符。 |