Advertisement

Spring Boot 调整定时任务 cron 参数设置

阅读量:

动态修改定时任务cron参数

复制代码
    	不需要重启应用就可以动态的改变Cron表达式的值
    	
    	不能使用@Scheduled(cron = "${jobs.cron}")实现
    
    
      
      
      
    

动态定时任务类DynamicScheduledTask

复制代码
    package com.jege.spring.boot.task;
    
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.scheduling.Trigger;
    import org.springframework.scheduling.TriggerContext;
    import org.springframework.scheduling.annotation.SchedulingConfigurer;
    import org.springframework.scheduling.config.

全部评论 (0)

还没有任何评论哟~