title: Spring Boot 2.1.1 : java.lang.IllegalStateException: Unable to retrieve @EnableAutoConfiguration base packages error when running unit test
body: <p>The following error will be thrown when I execute my unit test. Please kindly advise whether I missed out something. I am using Spring Boot 2.1.1.RELEASE. Thanks!</p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: Unable to retrieve
    @EnableAutoConfiguration base packages</p>
  </blockquote>
  
  <p><br>
  <strong>application-test.yml</strong></p>
  
  <pre><code>spring:
    profiles: test
    datasource:
      driver-class-name: org.h2.Driver
      url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
      username : xxx
      password : xxx
    jpa:
      hibernate:
        ddl-auto: update
    cache:
      type: simple
  </code></pre>
  
  <p><strong>AppRepository.java</strong></p>
  
  <pre><code>@Repository
  public interface AppRepository extends CrudRepository&lt;App, Integer&gt; {
  
      App findFirstByAppId(String appId);
  
  }   
  </code></pre>
  
  <p><strong>AppRepositoryTest.java</strong></p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @ContextConfiguration(classes = {AppRepository.class})
  @EnableConfigurationProperties
  @DataJpaTest
  @ActiveProfiles("test")
  public class AppRepositoryTest {
  
      @Autowired
      AppRepository appRepository;
  
      @Before
      public void setUp() throws Exception {
          App app = new App();
          app.setAppId("testId");
          appRepository.save(app);
      }
  
      @Test
      public void testFindFirstByAppId() {
          assertNotNull(appRepository.findFirstByAppId("testId"));        
      }
  }
  </code></pre>
  
  <p><strong>Package Structure</strong></p>
  
  <pre><code>└───src
      ├───main
      │   ├───java
      │   │   └───com
      │   │       └───abc
      │   │           └───app
      │   │               ├───config
      │   │               ├───data
      │   │               │   ├───model
      │   │               │   └───repository
      │   │               ├───exception
      │   │               ├───service
      │   │               └───serviceImpl
      │   └───resources
      │       ├───META-INF
      │       └───static
      │           ├───css
      │           ├───images
      │           └───js
      └───test
          └───java
              └───com
                  └───abc
                      └───app
                          ├───data
                          │   └───repository
                          ├───service
                          └───serviceImpl
  </code></pre>