来源:https://blog.csdn.net/qq_41055045/article/details/122038093
推荐适用于测试的 springboot 2.5 及以上版本中 application.yaml 配置示例:
# DataSource Config
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:test
username: root
password: test
sql:
init:
schema-locations: classpath:db/schema-h2.sql
data-locations: classpath:db/data-h2.sql
mode: always
不推荐的废弃配置方式:
spring:
datasource:
schema: classpath:db/schema-h2.sql
data: classpath:db/data-h2.sql