title: Spring can't find Autowired interface implementation
body: <p>I have a main SpringBootApplication class here:</p>
  
  <pre><code>package com.example.springproj;
  
  @SpringBootApplication
  public class App {
  
      public static void main(String[] args) {
          SpringApplication.run(App.class, args);
      }
  }
  </code></pre>
  
  <p>@RestController class here:</p>
  
  <pre><code>package com.example.springproj.controller;
  
  @RestController
  @Api("Sample")
  public class RefDataController {
  
      @Autowired
      @Qualifier("RefDataServiceImpl")
      private RefDataService refDataService;
  
      @GetMapping(path = {"/refdata"}, produces = {"application/json"})
      public ResponseEntity&lt;Configuration&gt; getRefData() {
          // etc
      }
  }
  </code></pre>
  
  <p>The controller autowires this interface:</p>
  
  <pre><code>package com.example.springproj.service;
  
  public interface RefDataService {
  
      Configuration getConfiguration(String param);
  }
  </code></pre>
  
  <p>Which is implemented by this class:</p>
  
  <pre><code>package com.example.springproj.services;
  @Service
  public class RefDataServiceImpl implements RefDataService {
  
      @Autowired
      private ConfigRepository config;
  
      @Value("${ENV}")
      private String environment;
  
      @Override
      public Configuration getConfiguration(String param) {
          // etc
      }
  }
  </code></pre>
  
  <p>But when I run the App.java file, I get this </p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Field refDataService in com.citi.icrm.risk.springproj.controller.RefDataController required a bean of type 'com.citi.icrm.risk.springproj.service.RefDataService' that could not be found.
  
  The injection point has the following annotations:
      - @org.springframework.beans.factory.annotation.Autowired(required=true)
      - @org.springframework.beans.factory.annotation.Qualifier(value=RefDataServiceImpl)
  
  
  Action:
  
  Consider defining a bean of type 'com.citi.icrm.risk.springproj.service.RefDataService' in your configuration.
  </code></pre>
  
  <p>I'm reasonably sure that this auto-wiring should work, and I'm not sure how to go about configuring this bean in a Spring boot app. What am I doing wrong?</p>
  
  <p>EDIT: Things I've already tried include: </p>
  
  <p>Removing all of the @Qualifier annotations</p>
  
  <pre><code>@RestController
  @Api("Sample")
  public class RefDataController {
  
      @Autowired
      private RefDataServiceImpl refDataService;
  
      @GetMapping(path = {"/refdata"}, produces = {"application/json"})
      public ResponseEntity&lt;Configuration&gt; getRefData() {
          System.err.println("testing.");
          return new ResponseEntity&lt;Configuration&gt;(refDataService.getConfiguration("EEMS_USER_DETAIL_URL"), HttpStatus.OK);
      }
  }
  </code></pre>
  
  <pre><code>public class RefDataServiceImpl implements RefDataService {
  
      @Autowired
      private ConfigRepository config;
  
      @Value("${ENV}")
      private String environment;
  
      @Override
      public Configuration getConfiguration(String param) {
          try {
              return config.getConfiguration(param, environment);
          } catch (Exception e) {
              e.printStackTrace();
              throw (RuntimeException) new RuntimeException().initCause(e);
          }
      }
  }
  </code></pre>
  
  <p>Changing the bean names to match convention</p>
  
  <pre><code>@RestController
  @Api("Sample")
  public class RefDataController {
  
      @Autowired
      @Qualifier("refDataServiceImpl")
      private RefDataService refDataService;
  
      @GetMapping(path = {"/refdata"}, produces = {"application/json"})
      public ResponseEntity&lt;Configuration&gt; getRefData() {
          System.err.println("testing.");
          return new ResponseEntity&lt;Configuration&gt;(refDataService.getConfiguration("EEMS_USER_DETAIL_URL"), HttpStatus.OK);
      }
  }
  </code></pre>
  
  <pre><code>@Service("refDataServiceImpl")
  public class RefDataServiceImpl implements RefDataService {
  
      @Autowired
      private ConfigRepository config;
  
      @Value("${ENV}")
      private String environment;
  
      @Override
      public Configuration getConfiguration(String param) {
          try {
              return config.getConfiguration(param, environment);
          } catch (Exception e) {
              e.printStackTrace();
              throw (RuntimeException) new RuntimeException().initCause(e);
          }
      }
  }
  </code></pre>
  
  <p>For reference, the files fall into the app's package structure like so:</p>
  
  <pre><code>com.example.springproj
  -&gt; com.example.springproj.controller
  --&gt; RefDataController
  -&gt; com.example.springproj.services
  --&gt; RefDataService
  -&gt; com.exampple.springproj.services.impl
  ---&gt; RefDataServiceImpl
  </code></pre>
  
  <p>Here's the folder structure, since some people have asked:</p>
  
  <p><a href="https://i.stack.imgur.com/EbonI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EbonI.png" alt="enter image description here"></a></p>