Scheduled tasks for the Java Spring Framework

Source: Internet
Author: User
Tags java spring framework

Because of the test, recently had to touch the Java spring @Scheduled scheduled tasks, it was thought that the configuration of the expression and crontab is exactly the same, did not expect a bit different.

in spring , a cron expression has at least 6 or 7 space-delimited time elements.

As follows:

Example:

0 0/5 * * * is triggered every 5 minutes

0 15 10 * *? Triggered 10:15 daily

PS: Usage:

And then set it in the configuration file (such as the Application.properties file)

Can.

in Linux contab , it is a 5-bit time element, which represents the minute, time, day, month, and week respectively . The expression is followed by the command you want to execute.

*/5 * * * * * run.sh means to execute run.sh files every 5 minutes

Ps:crontab basic Commands

Crontab-l Viewing timed tasks

Crontab-e into the edit page

Crontab-r Removing timed tasks

Scheduled tasks for the Java Spring Framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.