maven 依赖
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency>
先启动h2Server
public static void main(String[] args) throws Exception
{
Server h2Server = Server.createTcpServer().start();
if (!h2Server.isRunning(true)) {
System.out.println("h2db error");
System.exit(-1);
}
SpringApplication.run(RemoteCmdApplication.class, args);
}
yml配置文件
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:C:\Users\foo\Desktop\customer_file_name;AUTO_SERVER=TRUE
username: sa
password: