1. 程式人生 > >Springboot --- Bug集

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。啟動以後就可以正常執行。