Spring Cron scheduler “disable pattern”

前端 未结 3 472
感动是毒
感动是毒 2020-12-20 11:12

My application loads some cron patterns from a properties file. I\'m using the @Scheduled annotation like this:

@Scheduled(cron = "${config.         


        
3条回答
  •  忘掉有多难
    2020-12-20 12:07

    Per the Javadocs, as of Spring 5.1.0 the @Scheduled annotation can accept "-" as the cron expression to disable the cron trigger.

    The special value "-" indicates a disabled cron trigger, primarily meant for externally specified values resolved by a ${...} placeholder.

提交回复
热议问题