title: Could not autowire. No beans of `Repository' type found
body: <p>I'm using Spring Data Jpa, this is my project structure:</p>
  
  <pre><code>App
    ConfigPackage
      MyConfig
    ServicePackage
      MyService
    RepositoryPackage
      MyRepository
  </code></pre>
  
  <p>Here is the <code>MyRepository</code>:</p>
  
  <pre><code>public interface MyRepository extends JpaRepository&lt;MyEntity, Long&gt; {
  }
  </code></pre>
  
  <p>Here is the <code>MyService</code>:</p>
  
  <pre><code>@Service
  public class MyService {
  
      @Autowired
      private MyRepository myRepository; &lt;---here
  
      ...
  }
  </code></pre>
  
  <p>Here is the <code>MyConfig</code>:</p>
  
  <pre><code>@Configuration
  @EnableJpaRepositories(
          basePackages = "RepositoryPackage",
          entityManagerFactoryRef = "xxx",
          transactionManagerRef = "xxx"
  )
  public class MyConfig {
  }
  </code></pre>
  
  <p>I use <code>@Autowired</code> to inject <code>MyRepository</code> to <code>MyService</code>, but IntelliJ always complains </p>
  
  <blockquote>
    <p>Could not autowire. No beans of 'MyRepository' type found</p>
  </blockquote>
  
  <p>even if the code can compile and run successfully. </p>
  
  <p>Why can not IntelliJ recognize this is not an error? How to remove the warning of IntelliJ?</p>
  
  <p>IntelliJ Version: 2018.2.6</p>