springboot启动时报错Cannot determine embedded database driver cla

时间:2022-05-22 19:23:23

 

 springboot启动报错如下图:

springboot启动时报错Cannot determine embedded database driver cla

 

 

 

出错原因:springboot启动时会自动注入数据源及配置jpa

解决办法:

1,在pom文件中加h2引用

 

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

 

springboot启动时报错Cannot determine embedded database driver cla

 

 2.在启动类上加上

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

springboot启动时报错Cannot determine embedded database driver cla

 

 3,以上解决办法只是针对该springboot应用不与数据库之间有交互的场景下,使用,

若应用与数据库有交互,那么@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) 是不能用的!!!!!