-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Nikolay Bogdanov opened SPR-16858 and commented
To disable a spring job which uses cron expression you need at least 2 properties:
...
@Value("${jobs.name.enable}")
private boolean jobEnable;
@Scheduled(cron = "0 0 0 1 * ?")
public void execute() \{
if(jobEnable){
//JOB HERE
}
}
...
}
But there is no way to configure it to don't start any execution at all, but its relatively valuable feature (you can google it, but here is an example https://stackoverflow.com/questions/13835221/quartz-cron-expression-that-will-never-execute)
So the idea of this issue is to enable support for some "never" value for cron expression which will prevent this job from execution forever, so you can use only 1 parameter to configure your job. Example:
@Scheduled(cron = "never")
The exact value to disable a job is negotiable.
Affects: 5.0.6
Referenced from: commits 3a5def0
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement