使用feign做远程过程调用时出现: ‘url‘ attribute is not specified and no embedded datasource could

最近在远程调用过程中出现了:

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

但是实际上我并没有做数据库相关的任何操作,出现此错误导致项目无法启动
检查原因:
可能是在导入依赖的时候导入的关于数据库的依赖,由于springboot的自动配置原理导致的错误!

<dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>6.0.14.Final</version>
      <scope>compile</scope>
    </dependency>

解决办法:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableDiscoveryClient
@EnableFeignClients
public class SearchApp {
    public static void main(String[] args) {
        SpringApplication.run(SearchApp.class,args);
    }
}

在启动类上的@springbootApplication中加入exclude = DataSourceAutoConfiguration.class,解除自动加载DataSourceAutoConfiguration,即可解决此问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值