springboot启动报错: Cannot determine embedded database driver class for database type NONE

 之前在eclipseqid启动项目的时候,一直正常启动,切换到idea后,启动一直报错,错误如下所示

springboot启动报错: Cannot determine embedded database driver class for database type NONE

百度了很久,几乎所有答案都是在@SpringBootApplication注解上添加exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class }),但是依旧没有把问题解决。后面发现启动的时候端口号好像对不上配置文件上的

springboot启动报错: Cannot determine embedded database driver class for database type NONE

我的配置文件是写着84的

springboot启动报错: Cannot determine embedded database driver class for database type NONE

仔细看这个圈起来的配置,Idea提示这是unused property,也就是说这些地方的配置都没有被使用到,这里卡了一段时间,想到是不是这个配置需要在project哪里设置一下呢?然后就到 project structure那里看看。

springboot启动报错: Cannot determine embedded database driver class for database type NONEspringboot启动报错: Cannot determine embedded database driver class for database type NONE

是否发现右边栏少了一些东西,对,就是Resources。然后试着添加resourdes文件夹到Resource Folders,如下所示

springboot启动报错: Cannot determine embedded database driver class for database type NONE

添加完成之后发现server.port 和spring.datasource.driverClassName变蓝色了

springboot启动报错: Cannot determine embedded database driver class for database type NONE

抱着试一试的心态,启动了项目

springboot启动报错: Cannot determine embedded database driver class for database type NONE

springboot启动报错: Cannot determine embedded database driver class for database type NONE

一切正常,到此问题已经解决。