Make use of NoOpTaskScheduler to disable task scheduling in tests
A NoOpTaskScheduler has been added to Spring Framework. We should look at how we can use it to disable scheduled tasks in integration tests (and perhaps at runtime as well) probably via some opt-in mechanism.
Hey, I'd like to start working on this enhancement. Would you be able to assign it to me @wilkinsona?
Thanks for the offer, @breader124, but I don't think we know how we want to implement this one yet. Unfortunately, other higher priority work means that we don't have the cycles to figure that out right now. If you have some time to sketch out some ideas when that would be great, but please be aware that it may be wasted effort if we decide to take a different direction.
I'm happy to help. I'll try to think about possible solutions and will post them here to review when I'm ready
@wilkinsona, I did some investigation and it seems that a reasonable solution would be to introduce spring.task.scheduling.enabled property and based on its value:
- create either
ThreadPoolTaskSchedulerorSimpleAsyncTaskSchedulerbean when the new property is not explicitly set tofalseor when it's missing - create the bean of type
NoOpTaskSchedulerwhen the property is explicitly set tofalse
I also propose to leave the creation of all beans of TaskSchedulerBuilder type when scheduling is disabled. If anyone injects them for any reason, it'd be problematic when they disappear after setting the spring.task.scheduling.enabled to false.
How does it sound to you? Do you see more aspects to consider?
Hey @philwebb, is there any news on the topic?
@breader124 We discussed the issue and would like to do something in 3.4. We can't really start work on it until 3.3 is out.