bollam_rohith
bollam_rohith

Reputation: 384

scheduled cron expression that never runs

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...!

Upvotes: 0

Views: 3744

Answers (2)

michal.jakubeczy
michal.jakubeczy

Reputation: 9507

You can use.

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

cron.expression=-

This works from Spring 5.1.

See the docs.

Upvotes: 2

Muhammad Waqas Dilawar
Muhammad Waqas Dilawar

Reputation: 2352

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
    }
}

Upvotes: 1

Related Questions