We are using bootstrap.properties in a Spring Boot app to configure Spring Cloud Config related properties.
We want to ignore these properties during the testing as we don't want to connect to config server for unit testing. So we are looking for a way to completely undo properties from main bootstrap.properties
and provide a new one for testing or override selective properties.
We tried with creating src/test/resources/bootstrap.properties
, src/test/resources/bootstrap-test.properties
with spring.cloud.config.enabled=false
property but it didn't work.
we tried to set as below before starting the TestClass
static {
System.setProperty("spring.cloud.config.enabled", "false");
}
and it didn't work.
While Spring Boot documentation is pretty good about how application.properties works, I couldn't find even one reference to bootstrap.properties
.
Any help is much appreciated on a reliable way to override bootstrap.properties
during testing.