Springboot --- Bug集

一. 启动springboot报错:找不到或无法加载主类

  解决:直接选中项目,在ecplise选中"project",点击clean 清理项目再运行 问题解决。

二.报错:Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.

 解决:因为添加了springboot整合mybatis的jar包,连接mysql的jar包,但是没有配置响应的数据源导致该报错

    1. 配置可用的数据源

    2. 在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude= {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。

原文地址:https://www.cnblogs.com/maria-ld/p/9911461.html