I'm using java scheduled in my project. After calling a rest api in my project, I start scheduled in my program. Likewise, I stop this scheduled with another rest api. In other words, I create, stop, run, etc. scheduled in runtime.
I want to convert this code from java scheduled to spring schedule.
When I look at the code samples, I can start scheduled by time. Or I can start it according to the parameter I gave in application.properties. However, none of them meet my will.My request is simply as follows.
if(condition) {
startScheduled();
}
else {
stopScheduled();
}
but I could not find such an example.Can you help me?