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