title: Spring-boot repository not being registered as a valid bean
body: <p>Spring-boot does not seem to want to register my repository as a valid bean :( Here is the error I am seeing:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.frustrated.stats.MyRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
  </code></pre>
  
  <p>The underlying cause seems to be:</p>
  
  <pre><code>o.s.c.a.ClassPathBeanDefinitionScanner   : Ignored because not a concrete top-level class: file [/Users/me/Code/my_app/my_service/build/classes/java/main/com/frustrated/stats/MyRepository.class]
  </code></pre>
  
  <p>Have I configured my application improperly somewhere?</p>
  
  <p>Here are my files:</p>
  
  <p><strong>MyRepository.java</strong>:</p>
  
  <pre><code>package com.frustrated.stats;
  
  @Repository
  public interface MyRepository extends JpaRepository&lt;StatsEvent, Long&gt; {}
  </code></pre>
  
  <p><strong>StatsEvent.java</strong>:</p>
  
  <pre><code>package com.frustrated.stats;
  
  @Entity
  public class StatsEvent { ... }
  </code></pre>
  
  <p><strong>Application.java</strong>:</p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan(basePackages = { "com.frustrated" })
  @EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
  @EnableSpringDataWebSupport
  public class Application extends SpringBootServletInitializer {
  </code></pre>
  
  <p>Here is my package structure:</p>
  
  <pre><code>com:
    frustrated:
      - Application.java
      stats:
        - MyRepository.java
        - StatsEvent.java
  </code></pre>
  
  <p><strong>Attempts to Debug</strong></p>
  
  <p>After trying a lot of different annotations, I thought it may be more productive to simply step through the registration process. I have traced the code, and it seems to be failing <a href="https://github.com/spring-projects/spring-framework/blob/1c40e36839b45c5a1dfb06ad85c65a21dd3be235/spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java#L526" rel="nofollow noreferrer">here</a>:</p>
  
  <pre><code>    protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
          AnnotationMetadata metadata = beanDefinition.getMetadata();
          return (metadata.isIndependent() &amp;&amp; (metadata.isConcrete() ||
              (metadata.isAbstract() &amp;&amp; metadata.hasAnnotatedMethods(Lookup.class.getName()))));
  }
  </code></pre>
  
  <p>It is the <code>metadata.hasAnnotatedMethods(Lookup.class.getName())</code> that is false and causing my repository to not be instantiated as such.</p>
  
  <p>It may also be of note that my <code>StatsEvent</code> is also ignored because:</p>
  
  <pre><code>o.s.c.a.ClassPathBeanDefinitionScanner   : Ignored because not matching any filter: file [/Users/me/Code/my_app/my_service/build/classes/java/main/com/frustrated/stats/StatsEvent.class]
  </code></pre>
  
  <p><em>Any help would be greatly appreciated!</em></p>