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

使用前端

因爲給前端作分頁java

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

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

Reason: Failed to determine a suitable driver classspring

 

 因爲使用分頁依賴spring-boot

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

  致使須要配置數據源,可是咱們消費者是不須要配置的ui

那麼咱們就須要在啓動類中增長註解禁止掉驅動數據源 url

添加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);

    }
}
相關文章
相關標籤/搜索