I have a spring boot project with the following structure

```
src
|--- main
|    |--- java
|    |    |--- io.example.config
|    |    |    |--- AppConfig (Annotated @Cofiguration)
|    |    |--- io.example.beans 
|    |    |    |--- Bean1 (Annotated @Component)
|    |    |    |--- Bean2 (Annotated @Component)
|    |    |--- io.example.repository
|    |    |    |--- Repo (DynamoDB Crud Repo; Annotated @EnableScane)
|    |    |--- io.example.main
|    |    |    |--- Application (Annotated @SpringBootApplication)
|    |--- module-info.java
|--- test
|    |--- java
|    |    |--- io.example.main
|    |    |    |--- IntTest (Annotated @SpringBootTest)

```

The code in the *IntTest* class looks like

```
@RunWith(SpringRunner.class)
@SpringBootTest
public class IntTest {
  ...
}

```

When I run the tests from IntelliJ it runs fine. But I run it from maven `mvn test` it throws the following error

```
Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

```

I read some of the documentation and similar questions in SO. **Most of the solution rectifies the package alignment between source and test folder.** Which is not a problem in my case.

**The test runs fine with `mvn test` when I do the following I explicitly define the context dependencies**

```
package io.example.main;

import org.springframework.test.context.junit4.SpringRunner;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import io.example.config.AppConfig;
import io.example.beans.Bean1;
import io.example.beans.Bean2;

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = { Application.class, AppConfig.class, Bean1.class, Bean2.class })
@SpringBootTest
public class IntTest {
  ...

  @Autowired
  private Bean1 b1;

  @Autowired
  private Bean2 b2;

  @Test
  public void testRandom() {
      /* assert statements */
  }
}

```

I can do the above, but is there any way I can run the tests without explicitly defining `ContextConfiguration`?