错误信息:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'feginController': Unsatisfied dependency expressed through field 'feginClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.hdph.feign.feign.FeginClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-netflix-ribbon?
并且启动类增加
@EnableDiscoveryClient 报错,没有引入客户端依赖。
在pom文件中引入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
结果就可以引入FeginClient 可能是因为没有包进行实例化