SpringBoot启动时报错
-
错误信息 : Reason: Failed to determine a suitable driver class.
-
原因排查.启动的项目只是模拟进行远程调用,本项目没有添加数据库相关配置,而Springboot在添加了mybatis相关依赖后后会自动创建DataSource,所以会出现错误:
-
解决方案 : 在启动类上设置不让它创建.
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}) public class EurekaDemoApplication { public static void main(String[] args) { SpringApplication.run(EurekaDemoApplication.class,args); } }