Scheduling a job with Spring programmatically (with fixedRate set dynamically)

Using a Trigger you can calculate the next execution time on the fly. Something like this should do the trick (adapted from the Javadoc for @EnableScheduling): @Configuration @EnableScheduling public class MyAppConfig implements SchedulingConfigurer { @Autowired Environment env; @Bean public MyBean myBean() { return new MyBean(); } @Bean(destroyMethod = “shutdown”) public Executor taskExecutor() { return Executors.newScheduledThreadPool(100); … Read more