Springboot启动的时候会出现数据源错误
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver clas
原因:pom中引用了Mybatis的相关jar包
- 在springboot启动的时候,springboot的自动配置就会去寻找可用的数据源或者我们指定的数据源,但是application.yml(或 application.properties) 也没有指定,因此启动失败了
解决方法 1、取消引用即可
解决方法 2、配置数据源
解决方法 3、在@SpringBootApplication注解中,剔除掉数据源自动设置
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
本文探讨了SpringBoot启动时出现的数据源配置错误问题,详细分析了错误原因,并提供了三种解决方案:取消引用Mybatis相关jar包、正确配置数据源、或在@SpringBootApplication注解中排除数据源自动配置。


被折叠的 条评论
为什么被折叠?



