如题,搜索引擎查了许久都没查出来是为什么不用配置~
后面在看SpringBoot文档的时候无意间发现的
Spring Boot can auto-configure embedded H2, HSQL, and Derby databases.
You need not provide any connection URLs.
You need only include a build dependency to the embedded database that you want to use.
If there are multiple embedded databases on the classpath,
set the spring.datasource.embedded-database-connection configuration property to control which one is used.
Setting the property to none disables auto-configuration of an embedded database.
大概意思是:
SpringBoot可以自动配置H2,HSQL等内存数据库
只需引入依赖即可,不需要我们提供任何配置信息
如果有多个内存数据库,则需要配置spring.datasource.embedded-database-connection
当然,也可以禁用自动配置,这时需要自己配置数据库信息