0

Within the SpringBoot application you can provide the configuration via src/main/resource/application.yml.

One single entry should be overriden by the tests (see How to mock Eureka when doing Integration Tests in Spring? ). I tried to provide a test configuration with src/integration-test/resource/application.yml but it overrides the complete configuration.

eureka:
  client:
    enabled: false

How can I modify one entry of the configuration file for all tests?

sschmeck
  • 7,233
  • 4
  • 40
  • 67

1 Answers1

0

Create a application-test.yml in src/main/resource/ with your desired configuration (eureka.client.enabled=false) and also other configurations that you require for your application to start up,

Once your application-test.yml is complete You just need to add following annotation with desired value to your test class ,

@SpringBootTest(value={"spring.profiles.active=test"})

Here spring.profiles.active=test because we have set its value to test because we want to read configurations from application-test.yml.

Hope it helps !

rdj7
  • 1,905
  • 4
  • 18
  • 33