0

What I tried:

 @Scheduled(cron="* * * 08 04 2099")

I want cron expression that never executes.can any one help me with the expression.

Thanks in advance...!

bollam_rohith
  • 334
  • 4
  • 17

2 Answers2

1

This cron will run every minute and task will be bound with condition. If you need different cron job then you can generate using this website.

@Scheduled(cron = "0 0/1 * 1/1 * ? *")
protected void performTask() {
    if (condition)//if value matches with database value
    {
        //perform the task
    }
}
Muhammad Waqas Dilawar
  • 1,844
  • 1
  • 23
  • 34
1

You can use.

@Scheduled(cron = "${cron.expression}")

cron.expression=-

This works from Spring 5.1.

See the docs.

michal.jakubeczy
  • 8,221
  • 1
  • 59
  • 63