Closed
Description
If an application defines a @Scheduled(fixedRateString = "PT6H")
tasks, then this task will be running on any @SpringBootTest
junit
test that does not explicit mock the bean containing the scheduled task.
@Service
public class SchedulerService {
@Scheduled(fixedRateString = "PT6H")
public void runOnStartup() {
}
}
This gets tedious if there are many more @Scheduled
tasks in the application that launch on startup by usage of fixedRate
or fixedRateString
.
It would be great if there could be a possibility to completely deactivate the execution of @Scheduled
tasks in junit.
Just like it is possible to deactivate any @Cacheable
annotation by simply setting spring.cache.type=none
dring junit tests.
Something like: spring.enable.scheduling=false
(default: true)