Skip to content

Instantly share code, notes, and snippets.

@tasdemirbahadir
Created December 2, 2019 16:17
Show Gist options
  • Select an option

  • Save tasdemirbahadir/8caf1575a44014b6a5fe1b002ecc6ece to your computer and use it in GitHub Desktop.

Select an option

Save tasdemirbahadir/8caf1575a44014b6a5fe1b002ecc6ece to your computer and use it in GitHub Desktop.
scheduler_service_init_jobs.java
@PostConstruct
public void initialize() {
repository.findAllByActive(true).forEach(eachJob -> {
taskScheduler.schedule(() -> service.execute(eachJob), new CronTrigger(eachJob.getCronExpression()));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment