SpringBoot A component required a bean of type ‘XXXX‘ that could not be found

女爷i 2024-03-27 17:51 140阅读 0赞

一、问题现象

SpingBoot 启动报错: A component required a bean of type ‘XXXX’ that could not be found
在这里插入图片描述

二、解决方案

1、pom.xml 增加 openfign 和 loadbalancer 的引用
  1. <!--OpenFeign-->
  2. <dependency>
  3. <groupId>org.springframework.cloud</groupId>
  4. <artifactId>spring-cloud-starter-openfeign</artifactId>
  5. <version>3.1.1</version>
  6. </dependency>
  7. <!--spring-cloud-loadbalancer-->
  8. <dependency>
  9. <groupId>org.springframework.cloud</groupId>
  10. <artifactId>spring-cloud-loadbalancer</artifactId>
  11. <version>3.1.1</version>
  12. </dependency>
2、在XXXApplication启动类上增加 @EnableFeignClients

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,140人围观)

还没有评论,来说两句吧...

相关阅读