springboot不连接数据库启动(原先连接了mysql数据库)
来源于deepseak
配置H2内存数据库(无需真实数据库)
添加H2依赖
在pom.xml中:
<dependency><groupId>com.h2database</groupId><artifactId>h2</artifactId><scope>runtime</scope>
</dependency>
配置application.properties
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true