Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class 消費者提示需要配置數據源


使用

由於給前端做分頁

在啟動消費者的時候遇到了這個問題

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

 

 由於使用分頁依賴

<!--分頁依賴-->
<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>

  導致需要配置數據源,但是我們消費者是不需要配置的

那么我們就需要在啟動類中增加注解禁止掉驅動數據源 

添加exclude = DataSourceAutoConfiguration.class
@SpringBootApplication(scanBasePackages = "com.clx.myshop",exclude = DataSourceAutoConfiguration.class)
public class MyShopServiceUserConsumerApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyShopServiceUserConsumerApplication.class, args);

    }
}

  

 

 
       


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM