Spring boot搭建启动时,启动失败,原因:Failed to determine a suitable driver class

初次使用spring boot,启动时去出现了以下错误:

Failed to configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.
Reason: Failed to determine a suitable driver class

思考:
本来是按照入门教程来做的项目,但因为心急,所以在刚开始勾选时,将SQL中的MySQL和mybaits也勾选了,可能是没有配置数据库而引起的问题。
解决方法:
在网上寻找后,得到解决方法:
在这里插入图片描述
在@SpringBootApplication后添加(exclude=DataSourceAutoConfiguration.class),并导入相关类即可正常启动。

猜你喜欢

转载自blog.csdn.net/qq_40213244/article/details/82952785