title: @DataJpaTest not loading required classes
body: <p>I'm attempting to set up some Spring Boot JPA tests using:</p>
  
  <pre><code>package biz.ianw.coindatabase.test;
  
  @RunWith(SpringRunner.class)
  @DataJpaTest     
  public class DbTests {
    @Test
    public void test1() { ... }
  }
  </code></pre>
  
  <p>I have a service class:</p>
  
  <pre><code>package biz.ianw.coindatabase.database;
  
  //@Service
  @Repository
  @Transactional(readOnly=false)
  public class CoinDbService { ... }
  </code></pre>
  
  <p>and an application:</p>
  
  <pre><code>package biz.ianw.coindatabase;
  
  @SpringBootApplication
  @Slf4j
  @Configuration
  @EnableEncryptableProperties
  public class Main {
    @Autowired
    CoinDbService dbService;
  ... }
  </code></pre>
  
  <p>Starting the test gives the error:</p>
  
  <blockquote>
    <p>Field dbService in biz.ianw.coindatabase.Main required a bean of type 'biz.ianw.coindatabase.database.CoinDbService' that could not be found.</p>
  </blockquote>
  
  <p>This is, I assumed, something to do with the type of beans @DataJpaTest loads during startup:</p>
  
  <blockquote>
    <p>@DataJpaTest can be used if you want to test JPA applications. By
    default it will configure an in-memory embedded database, scan for
    @Entity classes and configure Spring Data JPA repositories. Regular
    @Component beans will not be loaded into the ApplicationContext.</p>
  </blockquote>
  
  <p>I'm not quite sure why @Service classes should be considered as not required for JPA testing, but I tried to force the matter by annotating it as @Repository instead, but to no avail.</p>
  
  <p>I can manually load the class with @Import(...) but it seems a tad hooky.  Is there a better way to tell DataJpaTest what I need for testing?</p>