I need to create an application which loads the data into database during the night(f.i 4a.m). I found this tutorial: http://websystique.com/spring/spring-job-scheduling-with-scheduled-enablescheduling-annotations/
And this scheduling works great! However..., to somehow tell my application that it will start to use the scheduler I have to write:
AbstractApplicationContext context = new AnnotationConfigApplicationContext(ApplicationScheduler.class);
and... I have no idea where to put it. I cannot put it into my controller because then it will be set at that time when user enters the webpage and at the begining there will be no data. So I need this scheduler to be set up when I deploy my application on server. For example, I put my app on server at 2a.m and then it knows that at 4a.m it will download the data.
To sum up, I know how to set this scheduler to do what I want at the time I want. I just have no idea where I should set this abstract application context.