Java stand-alone application as Scheduled tast executor with Spring

284 Views Asked by At

I need to create stand alone application only for processing periodical tasks. Currently I did it by using Spring with @Scheduled tasks, but I don't like while(true) construction.

public static void main(final String[] args) {
    final ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");
    while (true) ;
}

Is there a better solution, like sleeping current thread?

0

There are 0 best solutions below