{"id":1590,"date":"2017-07-05T16:22:24","date_gmt":"2017-07-05T08:22:24","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1590"},"modified":"2017-07-05T16:22:24","modified_gmt":"2017-07-05T08:22:24","slug":"scheduled-%e5%ae%9a%e6%97%b6%e4%bb%bb%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1590","title":{"rendered":"@Scheduled \u5b9a\u65f6\u4efb\u52a1"},"content":{"rendered":"<p>\n\t\u5173\u4e8e @Scheduled \u6211\u76f8\u4fe1\u5927\u5bb6\u5e76\u4e0d\u964c\u751f\u3002\u4eca\u5929\u603b\u7ed3\u4e00\u4e0b\u5b83\u7684\u76f8\u5173\u914d\u7f6e\u3002\n<\/p>\n<h2>\n\t@Scheduled \u5b9a\u65f6\u5668<br \/>\n<\/h2>\n<p>\n\t@Scheduled \u5b9a\u65f6\u5668\u7684\u4f7f\u7528\u5f88\u7b80\u5355\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\n@Component  \/\/import org.springframework.stereotype.Component;    \r\npublic class MyTest{    \r\n      @Scheduled(cron=&quot;0\/5 * *  * * ? &quot;)   \/\/\u6bcf5\u79d2\u6267\u884c\u4e00\u6b21    \r\n      @Override    \r\n      public void myTest(){    \r\n            System.out.println(&quot;\u8fdb\u5165\u6d4b\u8bd5&quot;);    \r\n      }    \r\n} <\/pre>\n<h2>\n\tcron-like \u8868\u8fbe\u5f0f<br \/>\n<\/h2>\n<p>\n\t\u5b57\u6bb5 \u5141\u8bb8\u503c \u5141\u8bb8\u7684\u7279\u6b8a\u5b57\u7b26 &nbsp; &nbsp;<br \/>\n\t\u79d2 0-59 , &#8211; * \/ &nbsp; &nbsp;<br \/>\n\t\u5206 0-59 , &#8211; * \/ &nbsp; &nbsp;<br \/>\n\t\u5c0f\u65f6 0-23 , &#8211; * \/ &nbsp; &nbsp;<br \/>\n\t\u65e5\u671f 1-31 , &#8211; * ? \/ L W C &nbsp; &nbsp;<br \/>\n\t\u6708\u4efd 1-12 \u6216\u8005 JAN-DEC , &#8211; * \/ &nbsp; &nbsp;<br \/>\n\t\u661f\u671f 1-7 \u6216\u8005 SUN-SAT , &#8211; * ? \/ L C # &nbsp; &nbsp;<br \/>\n\t\u5e74\uff08\u53ef\u9009\uff09 \u7559\u7a7a, 1970-2099 , &#8211; * \/ &nbsp; &nbsp;<br \/>\n\t\u8868\u8fbe\u5f0f\u610f\u4e49 &nbsp; &nbsp;<br \/>\n\t&quot;0 0 12 * * ?&quot; \u6bcf\u5929\u4e2d\u534812\u70b9\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 ? * *&quot; \u6bcf\u5929\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 * * ?&quot; \u6bcf\u5929\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 * * ? *&quot; \u6bcf\u5929\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 * * ? 2005&quot; 2005\u5e74\u7684\u6bcf\u5929\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 * 14 * * ?&quot; \u5728\u6bcf\u5929\u4e0b\u53482\u70b9\u5230\u4e0b\u53482:59\u671f\u95f4\u7684\u6bcf1\u5206\u949f\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 0\/5 14 * * ?&quot; \u5728\u6bcf\u5929\u4e0b\u53482\u70b9\u5230\u4e0b\u53482:55\u671f\u95f4\u7684\u6bcf5\u5206\u949f\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 0\/5 14,18 * * ?&quot; \u5728\u6bcf\u5929\u4e0b\u53482\u70b9\u52302:55\u671f\u95f4\u548c\u4e0b\u53486\u70b9\u52306:55\u671f\u95f4\u7684\u6bcf5\u5206\u949f\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 0-5 14 * * ?&quot; \u5728\u6bcf\u5929\u4e0b\u53482\u70b9\u5230\u4e0b\u53482:05\u671f\u95f4\u7684\u6bcf1\u5206\u949f\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 10,44 14 ? 3 WED&quot; \u6bcf\u5e74\u4e09\u6708\u7684\u661f\u671f\u4e09\u7684\u4e0b\u53482:10\u548c2:44\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 ? * MON-FRI&quot; \u5468\u4e00\u81f3\u5468\u4e94\u7684\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 15 * ?&quot; \u6bcf\u670815\u65e5\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 L * ?&quot; \u6bcf\u6708\u6700\u540e\u4e00\u65e5\u7684\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 ? * 6L&quot; \u6bcf\u6708\u7684\u6700\u540e\u4e00\u4e2a\u661f\u671f\u4e94\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 ? * 6L 2002-2005&quot; 2002\u5e74\u81f32005\u5e74\u7684\u6bcf\u6708\u7684\u6700\u540e\u4e00\u4e2a\u661f\u671f\u4e94\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t&quot;0 15 10 ? * 6#3&quot; \u6bcf\u6708\u7684\u7b2c\u4e09\u4e2a\u661f\u671f\u4e94\u4e0a\u534810:15\u89e6\u53d1 &nbsp; &nbsp;<br \/>\n\t\u6bcf\u5929\u65e9\u4e0a6\u70b9 &nbsp; &nbsp;<br \/>\n\t0 6 * * * &nbsp; &nbsp;<br \/>\n\t\u6bcf\u4e24\u4e2a\u5c0f\u65f6 &nbsp; &nbsp;<br \/>\n\t0 *\/2 * * * &nbsp; &nbsp;<br \/>\n\t\u665a\u4e0a11\u70b9\u5230\u65e9\u4e0a8\u70b9\u4e4b\u95f4\u6bcf\u4e24\u4e2a\u5c0f\u65f6\uff0c\u65e9\u4e0a\u516b\u70b9 &nbsp; &nbsp;<br \/>\n\t0 23-7\/2\uff0c8 * * * &nbsp; &nbsp;<br \/>\n\t\u6bcf\u4e2a\u6708\u76844\u53f7\u548c\u6bcf\u4e2a\u793c\u62dc\u7684\u793c\u62dc\u4e00\u5230\u793c\u62dc\u4e09\u7684\u65e9\u4e0a11\u70b9 &nbsp; &nbsp;<br \/>\n\t0 11 4 * 1-3 &nbsp; &nbsp;<br \/>\n\t1\u67081\u65e5\u65e9\u4e0a4\u70b9 &nbsp; &nbsp;<br \/>\n\t0 4 1 1 * &nbsp; &nbsp;<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1590\">@Scheduled \u5b9a\u65f6\u4efb\u52a1<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e @Scheduled \u6211\u76f8\u4fe1\u5927\u5bb6\u5e76\u4e0d\u964c\u751f\u3002\u4eca\u5929\u603b\u7ed3\u4e00\u4e0b\u5b83\u7684\u76f8\u5173\u914d\u7f6e\u3002 @Scheduled \u5b9a\u65f6\u5668 @S [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1327,1328,1329,551,827],"class_list":["post-1590","post","type-post","status-publish","format-standard","hentry","category-java","tag-scheduled","tag-cron-like-","tag-cron","tag-spring","tag-827"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1590"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1590\/revisions"}],"predecessor-version":[{"id":1591,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1590\/revisions\/1591"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}