If in your TestCase class there is this annotations:
@SpringApplicationConfiguration(classes = {Application.class})
this will cause the
I'm a bit late to the party, but a reasonable approach is to mark the bean with @ConditionalOnProperty, e.g.
@ConditionalOnProperty(prefix = "job.autorun", name = "enabled", havingValue = "true", matchIfMissing = true)
public CommandLineRunner myRunner() {...}
The following annotation will then disable it in tests:
@SpringBootTest(properties = {"job.autorun.enabled=false"})