Reputation: 2496
I have a test class annotated with @DataJpaTest
which autoconfigures Cloud Config.
I want to stop that for that one test class. I cannot use the spring.cloud.config.enabled=false
application property, because that would disable it for all tests.
Any suggestions?
Upvotes: 2
Views: 2633
Reputation: 27018
@DataJpaTest
takes a excludeAutoConfiguration
argument. You can specify all the AutoConfig's which you want to exclude.
@DataJpaTest(excludeAutoConfiguration = {AbcCloudAutoConfig.class, DefCloudAutoConfig.class})
replace AbcCloudAutoConfig, DefCloudAutoConfig with the classes you want to exclude
Upvotes: 1
Reputation: 11
@DataJpaTest annotation has other attributes. I tried the following to specifically disable the Spring Cloud Config and it worked for me locally:
@DataJpaTest(properties = {"spring.cloud.config.enabled=false"})
Upvotes: 1