cron - Spring scheduler which is run after application is started and after midnight -


how describe spring scheduler run after application started , after 00:00 ?

i 2 separate constructs.

for after application starts, use @postconstuct, , every night @ midnight use @scheduled cron value set. both applied method.

public class myclass {     @postconstruct     public void onstartup() {         dowork();     }      @scheduled(cron="0 0 0 * * ?")     public void onschedule() {         dowork();     }      public void dowork() {         // work required on startup , @ midnight     } } 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -