如何才能正确修改H2数据库名?
配置中设置了H2数据库名为testdb, 但springboot应用启动后,名称变为了 ‘4c5e3c44-2b8f-43c7-8185-35dbf41cdf2c’, 配置文件中的名称未生效。
1.pom.xml中springboot版本:
groupId: org.springframework.boot
artifactId: spring-boot-starter-parent
version: 2.3.2.RELEASE
2.application.properties内容如下:
spring.datasource.driverClassName=org.h2.Driver
spring.datasoruce.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.platform=h2
spring.h2.console.settings.web-allow-others=true
spring.h2.console.path=/h2
spring.h2.console.enabled=true
3.启动应用后,控制台输出:
HikariProxyConnection@115589100 wrapping conn0: url=jdbc:h2:mem:4c5e3c44-2b8f-43c7-8185-35dbf41cdf2c user=SA