Is it possible to schedule Spring service method only once at exactly specified time? For example, current time is 2pm but when I hit the action button I want that my service method starts at 8pm. I'm familiar with @Scheduled annotation and I'm not sure how to write cron expression not to run periodically. This one @Scheduled(cron = "0 0 20 * * ?")
fires every day at 8pm.
Any suggestions?
Dead man's solution:
@Scheduled(initialDelay = 1000 * 30, fixedDelay=Long.MAX_VALUE)
You will be dead before it fires again.