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

php - Array to string conversion smarty template -

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -