We use bootstrap.properties in the Spring Boot application to configure Spring properties related to Cloud Config.
We want to ignore these properties during testing, because we do not want to connect to the configuration server for unit testing. Therefore, we are looking for a way to completely undo properties from the main bootstrap.properties and provide a new one for testing or overriding custom properties.
We tried to create src/test/resources/bootstrap.properties , src/test/resources/bootstrap-test.properties with the property spring.cloud.config.enabled=false , but this did not work.
we tried to install as shown below before running TestClass
static { System.setProperty("spring.cloud.config.enabled", "false"); }
and it didnโt work.
While the Spring Boot Documentation is pretty good with regards to how application.properties works, I could not even find a single link to bootstrap.properties .
Any help is much appreciated in a reliable way to override bootstrap.properties during testing.
source share