title: Can't autowire repository from an external Jar into Spring Boot App
body: <p>I have packaged my entire entities of the application and the repository interfaces into one jar. The repositories are written with @Repository annotation:</p>
  
  <pre><code>@Repository
  public interface InternalUserRepository extends JpaRepository&lt;InternalUser, Long&gt;{
  
  }
  </code></pre>
  
  <p>I have included this jar file inside my spring boot application and trying to autowire the interface like this from a controller:</p>
  
  <pre><code>@RestController
  public class AuthenticationController {
  
      @Autowired
      AuthenticationService authenticationService;
  
      @Autowired
      InternalUserRepository internalUserRepository;
  
  
      @GetMapping("/")
      public String home() {
          return "Hello World!";
      }
  
  }
  </code></pre>
  
  <p>My Main app class is written like:</p>
  
  <pre><code>@SpringBootApplication
  @EnableJpaRepositories
  @ComponentScan("com.cdac.dao.cdacdao.*")
  public class CdacAuthenticationMgntApplication {
  
  public static void main(String[] args) {
      SpringApplication.run(CdacAuthenticationMgntApplication.class, args);
  }
  }
  </code></pre>
  
  <p>The repository is not getting autowired. When I am firing up the Spring boor application I am getting the following error:</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Field internalUserRepository in 
  com.cdac.user.cdacauthenticationmgnt.controller.AuthenticationController required a bean of type 'com.cdac.dao.cdacdao.repository.InternalUserRepository' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'com.cdac.dao.cdacdao.repository.InternalUserRepository' in your configuration.
  </code></pre>
  
  <p>Have anyone tried similar architecture like this?</p>