title: How to create a bean for CrudRepository interface
body: <p>I'm trying to add a Database Loader to my Spring App, however I'm getting the following error:</p>
  
  <pre class="lang-java prettyprint-override"><code>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: 
  No qualifying bean of type [org...GameRepository] found
  for dependency: 
  expected at least 1 bean which qualifies as autowire candidate for this 
  dependency. Dependency annotations: {}"}}
  </code></pre>
  
  <p>I've read about instantiating the Repository, but I've also seen several examples where that's not needed, so what exactly am I missing? Do I need some configuration class where I enable <code>@EnableJpaRepositories</code>?</p>
  
  <pre class="lang-java prettyprint-override"><code>//GameRepository.java
  @Repository
  public interface GameRepository extends CrudRepository&lt;Game, Long&gt; {
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>//DatabaseLoader.java
  @Component
  public class DatabaseLoader implements CommandLineRunner{
  
      private final GameRepository repository;
  
      @Autowired
      public DatabaseLoader(GameRepository repository) {
          this.repository = repository;
      }
  
      @Override
      public void run(String... strings) throws Exception {
          this.repository.save(new Game("Sala 1"));
      }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>//Application.java
  @ComponentScan
  @EnableWebMvc
  public class Application extends SpringBootServletInitializer {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(Application.class);
      }
  }
  </code></pre>