Description:
Field productFeignClient in com.yun.ssyx.home.controller.CategoryApiController required a bean of type 'com.yun.client.product.ProductFeignClient' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.yun.client.product.ProductFeignClient' in your configuration.
第一种情况: 未添加注解
在启动类上添加 @EnableFeignClients({"xxx,xxx"}) ,并配置feign所在包路径
这个是我的feignClient类所在路径,替换为你的即可
第二种情况 : 添加了注解启动失败
查看是否添加了依赖
<!-- openfeign依赖 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version> 2.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version> 2.2.5.RELEASE</version>
</dependency>
按照以上操作就能解决了, 欢迎大家一起讨论.