Spring have nice feature called scheduler. Just simply create class and annotate method with @Scheduled(...) annotation and it's all. Example:



package com.test.jobs;

@Component("testTask")
public class TestTask {

//Fire at 8:30am every day
@Scheduled(cron="0 30 8 ? * *")
public void doSmth(){
//do it...
}
}

Of course spring config:









Possible time format :
http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger