Tag Archives: Spring Cloud Consumer

Spring cloud consumer feign injection error [How to Solve]

Error Message:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘orderInfoController’: Unsatisfied dependency expressed through field ‘baseFeign’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.sinoeve.ctm.orderconsumer.Feign.BaseFeign’: 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?
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE

The interface did not clearly indicate an error, so I had to target the pom configuration file first. As expected, it was a POM configuration problem

 

The error introduced here should correctly be

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>