If you want an embedded database please put a supported one on the classpath

背景:启动springboot项目报错-

Cannot determine embedded database driver class for database type NONE。

If you want an embedded database please put a supported one on the classpath.

但是在这个项目中并没有用到数据源,就很郁闷。

随后排查发现这个项目引入的依赖有数据库相关的依赖。

解决方法:

方法1:

在入口上配置

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

方法2:

在配置文件中配置

    spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration

猜你喜欢

转载自blog.csdn.net/JustDI0209/article/details/111355048