Is there a way to get @Scheduled job in Spring to start without starting the application/running the application?

187 Views Asked by At

There is a Batch job that I have annotated with @Scheduled and a Cron expression. When I run the application from my IDE, the scheduled job runs according to the condition provided. How does the scheduled job work if I do not start or run the app? I want it to run at a specified time every day?

1

There are 1 best solutions below

1
Mahmoud Ben Hassine On

No, you have to start your application and Spring will be execute the @Scheduled method according to the schedule you give.

If you want to run jobs at a specific schedule without having a JVM running continuously, you have to use an external scheduler like unix's cron for example.