@SqlConfig

@SqlConfig定义用于确定如何解析和运行 SQL 脚本的元数据 配置了@Sql注解。以下示例演示如何使用它:spring-doc.cadn.net.cn

@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 脚本中设置注释前缀和分隔符。