问题描述:

今天新建了一个springboot项目,结果发现启动时报错:

关于SpringBoot启动报错:Cannot determine embedded database driver class for database type NONE

问题原因:

上网搜了各种原因包括:

  • springboot启动时会自动注入数据源和配置jpa;
  • “DataSource”这个bean被加载了;

其中第二种是常用解决方法。

解决办法:

1、对于第一种情况,解决办法是在DemoApplication启动类的注解@SpringBootApplication后排除掉

DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class

关于SpringBoot启动报错:Cannot determine embedded database driver class for database type NONE

即可正常启动,因为是新建项目,为了访问helloworld,一般用第二种解决方法;

2、或者在pom.xml中找到导致DataSource被加载的依赖

关于SpringBoot启动报错:Cannot determine embedded database driver class for database type NONE

因为此时我们还没有配置数据源,因此将<groupId>org.mybatis.spring.boot</groupId>这一段注释掉即可。

启动后,便能在网页访问helloworld!

相关文章:

  • 2021-09-19
  • 2021-10-13
  • 2021-08-29
  • 2021-10-01
  • 2021-12-02
猜你喜欢
  • 2021-11-13
  • 2022-12-23
  • 2021-08-29
  • 2021-06-23
  • 2021-10-01
相关资源
相似解决方案