在 spring boot 中,我可以通过不使用@Scheduled方法的注释来安排 spring 作业吗?
我正在春季靴中从事春季工作。我想通过使用 cron 表达式来安排作业,但不使用@Scheduled(cron = " ")该方法的注释。
我知道我可以在这个方法中安排一个工作,如下所示。
@Scheduled (cron = "0 10 10 10 * ?")
public void execute() {
/ * some job code * /
}
Run Code Online (Sandbox Code Playgroud)
但我希望它是动态的,以便我可以将 cron 表达式作为用户的输入并安排它。