title: Spring boot application not able to find bean for feign client
body: <p>Getting below exception while testing feign functionality.<br/>
  *********************<br/>
  APPLICATION FAILED TO START<br/>
  *********************<br/></p>
  
  <p>Description:</p>
  
  <p>Field currencyConversionServiceProxy in com.in28minutes.microservices.currencyconversionservice.CurrencyConversionController required a bean of type 'com.in28minutes.microservices.currencyconversionservice.CurrencyConversionServiceProxy' that could not be found.</p>
  
  <p>The injection point has the following annotations:<br>
      - @org.springframework.beans.factory.annotation.Autowired(required=true)  </p>
  
  <p><strong>POM.xml</strong>         </p>
  
  <pre><code>&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.2.2.RELEASE&lt;/version&gt;
      &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  ....
  &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;spring-cloud.version&gt;Hoxton.SR1&lt;/spring-cloud.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-starter-config&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-starter-openfeign&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                  &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
   &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
              &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;import&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  </code></pre>
  
  <p><strong>CurrencyConversionServiceApplication.java</strong></p>
  
  <pre><code>@SpringBootApplication
  @EnableFeignClients
  public class CurrencyConversionServiceApplication {
  
    public static void main(String[] args) {
       SpringApplication.run(CurrencyConversionServiceApplication.class, args);
    }
  }
  </code></pre>
  
  <p><strong>CurrencyConversionController.java</strong></p>
  
  <pre><code>@RestController
  public class CurrencyConversionController {
  
    @Autowired
    private CurrencyConversionServiceProxy currencyConversionServiceProxy;
  
    @GetMapping("/currency-converter-feign/from/{from}/to/{to}/quantity/{quantity}")
    public CurrencyConversionBean convertCurrencyFeign(@PathVariable String from, @PathVariable String to,
          @PathVariable BigDecimal quantity) {
  
        CurrencyConversionBean response = currencyConversionServiceProxy.retrieveExchangeValue(from, to);
        return new CurrencyConversionBean(response.getId(), response.getFrom(), response.getTo(),
              response.getConversionMultiple(), quantity, quantity.multiply(response.getConversionMultiple()),
              response.getPort());
    }
  }
  </code></pre>
  
  <p><strong>CurrencyConversionServiceProxy.java</strong></p>
  
  <pre><code>@FeignClient(name="currency-exchange-service", url="localhost:8000")
  public interface CurrencyConversionServiceProxy {
  
    @GetMapping("/currency-exchange/from/{from}/to/{to}")
    public CurrencyConversionBean retrieveExchangeValue(@PathVariable("from") String from, @PathVariable("to") String to);
  
  }
  </code></pre>
  
  <p><strong>Logs</strong></p>
  
  <pre><code>      .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v2.2.2.RELEASE)
  
  2019-12-28 14:19:27.788  INFO 11444 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : 
  Fetching config from server at : http://localhost:8888
  2019-12-28 14:19:28.805  INFO 11444 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : 
  Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
  2019-12-28 14:19:28.805  WARN 11444 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : 
  Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/currency- 
  conversion-service/default": Connection refused: connect; nested exception is 
  java.net.ConnectException: Connection refused: connect
  2019-12-28 14:19:28.805  INFO 11444 --- [  restartedMain] m.c.CurrencyConversionServiceApplication : 
  No active profile set, falling back to default profiles: default
  2019-12-28 14:19:28.921  INFO 11444 --- [  restartedMain] o.s.cloud.context.scope.GenericScope     : 
  BeanFactory id=6fe0f2bd-0b38-367c-af3b-d79d3b2d9d52
  2019-12-28 14:19:28.937  WARN 11444 --- [  restartedMain] org.apache.tomcat.util.modeler.Registry  : 
  The MBean registry cannot be disabled because it has already been initialised
  2019-12-28 14:19:28.968  INFO 11444 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : 
  Tomcat initialized with port(s): 8100 (http)
  2019-12-28 14:19:28.968  INFO 11444 --- [  restartedMain] o.apache.catalina.core.StandardService   : 
  Starting service [Tomcat]
  2019-12-28 14:19:28.984  INFO 11444 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : 
  Starting Servlet engine: [Apache Tomcat/9.0.29]
  2019-12-28 14:19:28.984  INFO 11444 --- [  restartedMain] o.a.c.c.C.[Tomcat-16].[localhost].[/]    : 
  Initializing Spring embedded WebApplicationContext
  2019-12-28 14:19:28.984  INFO 11444 --- [  restartedMain] o.s.web.context.ContextLoader            : 
  Root WebApplicationContext: initialization completed in 178 ms
  2019-12-28 14:19:28.999  WARN 11444 --- [  restartedMain] ConfigServletWebServerApplicationContext : 
  Exception encountered during context initialization - cancelling refresh attempt: 
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 
  'currencyConversionController': Unsatisfied dependency expressed through field 
  'currencyConversionServiceProxy'; nested exception is 
  org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 
  'com.in28minutes.microservices.currencyconversionservice.CurrencyConversionServiceProxy' available: 
  expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: 
  {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  2019-12-28 14:19:29.015  INFO 11444 --- [  restartedMain] o.apache.catalina.core.StandardService   : 
  Stopping service [Tomcat]
  2019-12-28 14:19:29.015  INFO 11444 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 
  
  Error starting ApplicationContext. To display the conditions report re-run your application with 
  'debug' enabled.
  2019-12-28 14:19:29.093 ERROR 11444 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 
  
  ***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Field currencyConversionServiceProxy in 
  com.in28minutes.microservices.currencyconversionservice.CurrencyConversionController required a bean 
  of type 'com.in28minutes.microservices.currencyconversionservice.CurrencyConversionServiceProxy' 
  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.in28minutes.microservices.currencyconversionservice.CurrencyConversionServiceProxy' in your 
  configuration.
  </code></pre>
  
  <p><strong>I have tested service running at port 8000 is running fine under name "currency-exchange-service" only.</strong></p>