Skip to content

Instantly share code, notes, and snippets.

@tasdemirbahadir
Created December 2, 2019 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tasdemirbahadir/8caf1575a44014b6a5fe1b002ecc6ece to your computer and use it in GitHub Desktop.
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