title: How to exclude bootstrapping in META-INF/spring.factories from java tests
body: <p>Had this line in resources/META-INF/spring.factories:
  <code>org.springframework.cloud.bootstrap.BootstrapConfiguration=org.path.to.AWSConfig</code></p>
  <p>Integration test executions using <code>@RunWith(SpringRunner.class)</code> were failing while running AWSConfig. The tests don't need AWSConfig to run. Tried many methods on SO of excluding AWSConfig, including:</p>
  <ul>
  <li><code>@TestPropertySource(properties={&quot;spring.autoconfigure.exclude=org.path.to.AWSConfig&quot;})</code></li>
  <li><code>@EnableAutoConfiguration(exclude = { AWSConfig.class})</code></li>
  <li>Setting <code>spring.cloud.config.enabled=false</code></li>
  </ul>
  <p>But AWSConfig was still running (and failing). How do I exclude the bootstrapped configuration class from tests?</p>
  <p>Test setup:</p>
  <pre><code>@RunWith(SpringRunner.class)
  @WebMvcTest(UnitLeaderRequestController.class)
  @WithMockUser
  public class UnitLeaderRequestControllerTest {
      @Autowired
      MockMvc mvc;
      ...
  }
  </code></pre>