spring.datasource.schema指定启动后执行的sql文件位置。
我发现中文乱码,原因是没有指定执行sql script encoding:
spring:
datasource:
url: "jdbc:h2:mem:test"
username: "sa"
password: ""
schema: database/import.sql
sql-script-encoding: utf-8
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.h2.Driver
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 1
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat
唯有不断学习方能改变! -- Ryan Miao