springçš?é…置文äšg在å¯åŠ¨æ—¶åQŒåŠ è½½çš„æ˜¯web-info目录下的applicationContext.xml,
˜q行时ä‹É用的是web-info/classes目录下的applicationContext.xmlã€?br />
é…ç½®web.xml使这2个èµ\径一è‡ß_¼š
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
多个é…置文äšgçš„åŠ è½?br /><context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:conf/spring/applicationContext_core*.xml,
classpath*:conf/spring/applicationContext_dict*.xml,
classpath*:conf/spring/applicationContext_hibernate.xml,
classpath*:conf/spring/applicationContext_staff*.xml,
classpath*:conf/spring/applicationContext_security.xml
classpath*:conf/spring/applicationContext_modules*.xml
classpath*:conf/spring/applicationContext_cti*.xml
classpath*:conf/spring/applicationContext_apm*.xml
</param-value>
</context-param>
contextConfigLocation 傿•°å®šä¹‰äº†è¦è£…å…¥çš?Spring é…置文äšgã€?/p>
ç”׃ºŽæ˜¯ä‹Éç”?strong style="color: black; background-color: #ffff66; ">spring mvcæ¥åš™å¹ç›®åQŒå› æ¤è„±¼›ÖMº†HttpServletRequestä½œäØ“å‚æ•°åQŒä¸èƒ½å¤Ÿç›´æŽ¥ä½¿ç”¨requeståQŒè¦æƒ³ä‹É用requestå¯ä»¥ä½¿ç”¨ä¸‹é¢çš„æ–¹æ³•:
在web点xmlä¸é…¾|®ä¸€ä¸ªç›‘å?/p>
<listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener>之厞®±å¯ä»¥åœ¨½E‹åºä½¿ç”¨äº?p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
在xmlé…ç½®äº†è¿™ä¸ªæ ‡½{‘ÖŽåQŒspringå¯ä»¥è‡ªåЍåŽÀL‰«æbase-pack䏋颿ˆ–者å包下é¢çš„javaæ–‡äšgåQŒå¦‚果扫æåˆ°æœ‰@Component @Controller@Service½{‰è¿™äº›æ³¨è§£çš„¾c»ï¼Œåˆ™æŠŠ˜q™äº›¾cÀL³¨å†ŒäØ“bean
注æ„åQšå¦‚果酾|®äº†<context:component-scan>那么<context:annotation-config/>æ ‡ç¾ž®±å¯ä»¥ä¸ç”¨å†xmlä¸é…¾|®äº†åQŒå› 为å‰è€…包å«äº†åŽè€…。å¦å¤?lt;context:annotation-config/>˜q˜æä¾›äº†ä¸¤ä¸ªåæ ‡½{?/p>
1. <context:include-filter>
2. <context:exclude-filter>
åœ¨è¯´æ˜Žè¿™ä¸¤ä¸ªåæ ‡½{‘Ö‰åQŒå…ˆè¯´ä¸€ä¸?lt;context:component-scan>有一个use-default-filterså±žæ€§ï¼Œæ”¹å±žæ€§é»˜è®¤äØ“true,˜q™å°±æ„味ç€ä¼šæ‰«ææŒ‡å®šåŒ…ä¸‹çš„å…¨éƒ¨çš„æ ‡æœ?/span>@Component的类åQŒåƈ注册æˆ?/span>bean.也就æ˜?/span>@Componentçš„åæ³¨è§£@Service,@Reposity½{?/span>。所以如果仅仅是在酾|®æ–‡ä»¶ä¸˜q™ä¹ˆå†?/p>
<context:component-scan base-package="tv.huan.weisp.web"/>
Use-default-filteræ¤æ—¶ä¸ºtrue那么会对base-package包或者å包下的所有的˜q›è¡Œjava¾c»è¿›è¡Œæ‰«æ?òq¶æŠŠåŒšw…çš„java¾cÀL³¨å†Œæˆbeanã€?/p>
å¯ä»¥å‘现˜q™ç§æ‰«æçš„ç²’åº¦æœ‰ç‚¹å¤ªå¤§ï¼Œå¦‚æžœä½ åªæƒÏx‰«ææŒ‡å®šåŒ…下é¢çš„ControlleråQŒè¯¥æ€Žä¹ˆåŠžï¼Ÿæ¤æ—¶åæ ‡½{?lt;context:incluce-filter>ž®Þp“våˆîCº†å‹‡æ¦ä¹‹åœ°ã€‚如下所½C?/p>
<context:component-scan base-package="tv.huan.weisp.web .controller">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
˜q™æ ·ž®×ƒ¼šåªæ‰«æbase-package指定下的有@Controller下的java¾c»ï¼Œòq¶æ³¨å†Œæˆbean
ä½†æ˜¯å› äØ“use-dafault-filter在上é¢åƈ没有指定åQŒé»˜è®¤å°±ä¸ºtrueåQŒæ‰€ä»¥å½“把上é¢çš„é…ç½®æ”ÒŽˆå¦‚下所½Cºçš„æ—¶å€™ï¼Œž®×ƒ¼šäº§ç”Ÿä¸Žä½ 期望相悖的结æž?span style="color: red; ">åQˆæ³¨æ„?/span>base-package包值得å˜åŒ–åQ?/span>
<context:component-scan base-package="tv.huan.weisp.web ">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
æ¤æ—¶åQŒspringä¸ä»…扫æäº†@ControlleråQŒè¿˜æ‰«æäº†æŒ‡å®šåŒ…所在的å包service包下注解@Serviceçš„java¾c?/p>
æ¤æ—¶æŒ‡å®šçš„include-filter没有起到作用åQŒåªè¦æŠŠuse-default-filter讄¡½®æˆfalsež®±å¯ä»¥äº†ã€‚è¿™æ ·å°±å¯ä»¥é¿å…在base-packeageé…置多个包å˜q™ç§ä¸æ˜¯å¾ˆä¼˜é›…çš„æ–ÒŽ³•æ¥è§£å†Œ™¿™ä¸ªé—®é¢˜äº†ã€?/p>
å¦å¤–在我å‚与的项目ä¸å¯ä»¥å‘现在base-packageæŒ‡å®šçš„åŒ…ä¸æœ‰çš„å包是ä¸å«æœ‰æ³¨è§£äº†åQŒæ‰€ä»¥ä¸ç”¨æ‰«æï¼Œæ¤æ—¶å¯ä»¥æŒ‡å®š<context:exclude-filter>æ¥è¿›è¡Œè¿‡æ»¤ï¼Œè¯´æ˜Žæ¤åŒ…ä¸éœ€è¦è¢«æ‰«æã€‚综åˆä»¥ä¸Šè¯´æ˜?/p>
Use-dafault-filters=”false”的情况下åQ?lt;context:exclude-filter>æŒ‡å®šçš„ä¸æ‰«æåQ?lt;context:include-filter>指定的扫æ?/p>
å—æ®µ | å…许å€?/th> | å…许的特ŒDŠå—½W?/th> | ||
---|---|---|---|---|
¿U?/code> |
0-59 |
, - * / |
||
�/code> |
0-59 |
, - * / |
||
ž®æ—¶ |
0-23 |
, - * / |
||
日期 |
1-31 |
, - * ? / L W C |
||
月䆾 |
1-12 或�JAN-DEC |
, - * / |
||
星期 |
1-7 或�SUN-SAT |
, - * ? / L C # |
||
òqß_¼ˆå¯é€‰ï¼‰ |
留空, 1970-2099 |
, - * / |
The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".
“*”å—ç¬¦è¢«ç”¨æ¥æŒ‡å®šæ‰€æœ‰çš„倹{€‚如åQ?#8221;*“åœ¨åˆ†é’Ÿçš„å—æ®µåŸŸé‡Œè¡¨ç¤º“æ¯åˆ†é’?#8221;ã€?nbsp;
The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fileds, but not the other. See the examples below for clarification.
“?”å—符åªåœ¨æ—¥æœŸåŸŸå’Œæ˜ŸæœŸåŸŸä¸ä½¿ç”¨ã€‚å®ƒè¢«ç”¨æ¥æŒ‡å®?#8220;éžæ˜Ž¼‹®çš„å€?#8221;ã€‚å½“ä½ éœ€è¦é€šè¿‡åœ¨è¿™ä¸¤ä¸ªåŸŸä¸çš„ä¸€ä¸ªæ¥æŒ‡å®šä¸€äº›ä¸œè¥¿çš„æ—¶å€™ï¼Œå®ƒæ˜¯æœ‰ç”¨çš„。看下é¢çš„例åä½ ž®×ƒ¼šæ˜Žç™½ã€?nbsp;
月䆾ä¸çš„æ—¥æœŸå’Œæ˜ŸæœŸä¸çš„æ—¥æœŸè¿™ä¸¤ä¸ªå…ƒç´ 时互斥的一起应该通过讄¡½®ä¸€ä¸ªé—®å??)æ¥è¡¨æ˜Žä¸æƒŒ™®¾¾|®é‚£ä¸ªå—ŒD?br />
The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".
“-”å—ç¬¦è¢«ç”¨æ¥æŒ‡å®šä¸€ä¸ªèŒƒå›´ã€‚如åQ?#8220;10-12”åœ¨å°æ—¶åŸŸæ„味瀓10ç‚V€?1ç‚V€?2ç‚?#8221;ã€?nbsp;
The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday".
“,”å—ç¬¦è¢«ç”¨æ¥æŒ‡å®šå¦å¤–的倹{€‚如åQ?#8220;MON,WED,FRI”在星期域里表½C?#8221;æ˜ŸæœŸä¸€ã€æ˜ŸæœŸä¸‰ã€æ˜ŸæœŸäº””.
The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the seconds field means "the seconds 5, 20, 35, and 50". Specifying '*' before the '/' is equivalent to specifying 0 is the value to start with. Essentially, for each field in the expression, there is a set of numbers that can be turned on or off. For seconds and minutes, the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to 31, and for months 1 to 12. The "/" character simply helps you turn on every "nth" value in the given set. Thus "7/6" in the month field only turns on month "7", it does NOT mean every 6th month, please note that subtlety.
The 'L' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "last", but it has different meaning in each of the two fields. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January, day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last friday of the month". When using the 'L' option, it is important not to specify lists, or ranges of values, as you'll get confusing results.
Læ˜?#8216;last’çš„çœç•¥å†™æ³•å¯ä»¥è¡¨½Cºday-of-monthå’Œday-of-weekåŸŸï¼Œä½†åœ¨ä¸¤ä¸ªå—æ®µä¸çš„æ„æ€ä¸åŒï¼Œä¾‹å¦‚day-of-month域ä¸è¡¨ç¤ºä¸€ä¸ªæœˆçš„æœ€åŽä¸€å¤©ï¼Œ
如果在day-of-week域表½C?#8216;7’或è€?#8216;SAT’åQŒå¦‚果在day-of-week域ä¸å‰é¢åŠ ä¸Šæ•°å—åQŒå®ƒè¡¨ç¤ºä¸€ä¸ªæœˆçš„æœ€åŽå‡ 天,例如‘6L’ž®Þp¡¨½CÞZ¸€ä¸ªæœˆçš„æœ€åŽä¸€ä¸?br />
星期五,
The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the boundary of a month's days. The 'W' character can only be specified when the day-of-month is a single day, not a range or list of days
.
The 'L' and 'W' characters can also be combined for the day-of-month expression to yield 'LW', which translates to "last weekday of the month".
The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month. For example, the value of "6#3" in the day-of-week field means the third Friday of the month (day 6 = Friday and "#3" = the 3rd one in the month). Other examples: "2#1" = the first Monday of the month and "4#5" = the fifth Wednesday of the month. Note that if you specify "#5" and there is not 5 of the given day-of-week in the month, then no firing will occur that month.
The 'C' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "calendar". This means values are calculated against the associated calendar, if any. If no calendar is associated, then it is equivalent to having an all-inclusive calendar. A value of "5C" in the day-of-month field means "the first day included by the calendar on or after the 5th". A value of "1C" in the day-of-week field means "the first day included by the calendar on or after sunday".
关于cronExpression的介¾l?
å—æ®µ å…许å€?å…许的特ŒDŠå—½W?nbsp;
¿U?0-59 , - * /
�0-59 , - * /
ž®æ—¶ 0-23 , - * /
日期 1-31 , - * ? / L W C
月䆾 1-12 或�JAN-DEC , - * /
星期 1-7 或�SUN-SAT , - * ? / L C #
òqß_¼ˆå¯é€‰ï¼‰ 留空, 1970-2099 , - * /
è¡¨è¾¾å¼æ„ä¹?nbsp;
"0 0 12 * * ?" æ¯å¤©ä¸åˆ12点触å?nbsp;
"0 15 10 ? * *" æ¯å¤©ä¸Šåˆ10:15触å‘
"0 15 10 * * ?" æ¯å¤©ä¸Šåˆ10:15触å‘
"0 15 10 * * ? *" æ¯å¤©ä¸Šåˆ10:15触å‘
"0 15 10 * * ? 2005" 2005òq´çš„æ¯å¤©ä¸Šåˆ10:15触å‘
"0 * 14 * * ?" 在æ¯å¤©ä¸‹å?点到下åˆ2:59期间的æ¯1分钟触å‘
"0 0/5 14 * * ?" 在æ¯å¤©ä¸‹å?点到下åˆ2:55期间的æ¯5分钟触å‘
"0 0/5 14,18 * * ?" 在æ¯å¤©ä¸‹å?点到2:55期间和下å?点到6:55期间的æ¯5分钟触å‘
"0 0-5 14 * * ?" 在æ¯å¤©ä¸‹å?点到下åˆ2:05期间的æ¯1分钟触å‘
"0 10,44 14 ? 3 WED" æ¯å¹´ä¸‰æœˆçš„æ˜ŸæœŸä¸‰çš„下å?:10å’?:44触å‘
"0 15 10 ? * MON-FRI" 周一臛_‘¨äº”的上åˆ10:15触å‘
"0 15 10 15 * ?" æ¯æœˆ15日上å?0:15触å‘
"0 15 10 L * ?" æ¯æœˆæœ€åŽä¸€æ—¥çš„上åˆ10:15触å‘
"0 15 10 ? * 6L" æ¯æœˆçš„æœ€åŽä¸€ä¸ªæ˜ŸæœŸäº”上åˆ10:15触å‘
"0 15 10 ? * 6L 2002-2005" 2002òq´è‡³2005òq´çš„æ¯æœˆçš„æœ€åŽä¸€ä¸ªæ˜ŸæœŸäº”上åˆ10:15触å‘
"0 15 10 ? * 6#3" æ¯æœˆçš„第三个星期五上å?0:15触å‘
æ¯å¤©æ—©ä¸Š6ç‚?nbsp;
0 6 * * *
æ¯ä¸¤ä¸ªå°æ—?nbsp;
0 */2 * * *
晚上11点到早上8点之间æ¯ä¸¤ä¸ªž®æ—¶åQŒæ—©ä¸Šå…«ç‚?nbsp;
0 23-7/2åQ? * * *
æ¯ä¸ªæœˆçš„4å·å’Œæ¯ä¸ª½C¼æ‹œçš„礼拜一到礼拜三的早ä¸?1ç‚?nbsp;
0 11 4 * 1-3
1�日早��nbsp;
0 4 1 1 *
quartz的高¾U§ç‰¹æ€§ä¸ä»…如æ?nbsp;
1 æ•°æ®åº“å˜å‚?nbsp;
2 集群支æŒ
3 æ•°æ®åº“æŒä¹…化ä»ÕdŠ¡åQŒtrigger
4 trigger çš„åœæ¢ï¼Œ˜q行
5 ä»ÕdŠ¡çš„ä“Qæ„æ·»åŠ?nbsp;
6 比corntrigger 更详ž®½çš„ä»ÕdŠ¡å®‰æŽ’
7 ¾U¿ç¨‹çš„内部数æ®äº¤æ?br />
一个cronè¡¨è¾¾å¼æœ‰è‡›_°‘6个(也å¯èƒ?ä¸ªï¼‰æœ‰ç©ºæ ¼åˆ†éš”çš„æ—‰™—´å…ƒç´ ã€?br />按顺åºä¾‹Æ¡äØ“
1.¿U’(0~59åQ?br />2.分钟åQ?~59åQ?br />3.ž®æ—¶åQ?~23åQ?/span>
4.天(月)åQ?~31åQŒä½†æ˜¯ä½ 需è¦è€ƒè™‘ä½ æœˆçš„å¤©æ•ŽÍ¼‰
5.月(0~11åQ?br />6.天(星期åQ‰ï¼ˆ1~7 1=SUN æˆ?SUNåQŒMONåQŒTUEåQŒWEDåQŒTHUåQŒFRIåQŒSATåQ?br />7.òq´ä†¾åQ?970åQ?099åQ?/span>
其䏿¯ä¸ªå…ƒç´ å¯ä»¥æ˜¯ä¸€ä¸ªå€?å¦?),一个连¾l区é—?9-12),一个间隔时é—?8-18/4)(/表示æ¯éš”4ž®æ—¶),一个列è¡?1,3,5),通酽W¦ã€?br />ç”׃ºŽ"月䆾ä¸çš„æ—¥æœŸ"å’?星期ä¸çš„æ—¥æœŸ"˜q™ä¸¤ä¸ªå…ƒç´ 互斥的,å¿…é¡»è¦å¯¹å…¶ä¸ä¸€ä¸ªè®¾¾|?.
0 0 10,14,16 * * ? æ¯å¤©ä¸Šåˆ10点,下åˆ2点,4ç‚?br />0 0/30 9-17 * * ??? æœä¹æ™šäº”工作旉™—´å†…æ¯åŠå°æ—?br />0 0 12 ? * WED 表示æ¯ä¸ªæ˜ŸæœŸä¸‰ä¸å?2ç‚?/span>
有些å表辑ּ能包å«ä¸€äº›èŒƒå›´æˆ–列表
例如åQšå表达å¼ï¼ˆå¤©ï¼ˆæ˜ŸæœŸåQ‰ï¼‰å¯ä»¥ä¸?“MON-FRI”åQ?#8220;MONåQŒWEDåQŒFRI”åQ?#8220;MON-WED,SAT”
“*”å—符代表所有å¯èƒ½çš„å€?br />å› æ¤åQ?#8220;*”在å表达å¼ï¼ˆæœˆï¼‰é‡Œè¡¨½Cºæ¯ä¸ªæœˆçš„å«ä¹‰ï¼Œ“*”在å表达å¼ï¼ˆå¤©ï¼ˆæ˜ŸæœŸåQ‰ï¼‰è¡¨ç¤ºæ˜ŸæœŸçš„æ¯ä¸€å¤?/span>
“/”å—ç¬¦ç”¨æ¥æŒ‡å®šæ•°å€¼çš„增é‡
例如åQšåœ¨å表辑ּåQˆåˆ†é’Ÿï¼‰é‡Œçš„“0/15”表示从第0分钟开始,æ¯?5分钟 ;
在å表达å¼ï¼ˆåˆ†é’ŸåQ‰é‡Œçš?#8220;3/20”表示从第3分钟开始,æ¯?0分钟åQˆå®ƒå’?#8220;3åQ?3åQ?3”åQ‰çš„å«ä¹‰ä¸€æ ?br />
“åQ?#8221;å—符仅被用于天(月)和天åQˆæ˜ŸæœŸï¼‰ä¸¤ä¸ªå表辑ּåQŒè¡¨½CÞZ¸æŒ‡å®šå€?br />å½?个å表达å¼å…¶ä¸ä¹‹ä¸€è¢«æŒ‡å®šäº†å€ég»¥åŽï¼Œä¸ÞZº†é¿å…冲çªåQŒéœ€è¦å°†å¦ä¸€ä¸ªå表达å¼çš„倯D®¾ä¸?#8220;åQ?#8221;
“L” å—符仅被用于天(月)和天åQˆæ˜ŸæœŸï¼‰ä¸¤ä¸ªå表辑ּåQŒå®ƒæ˜¯å•è¯?#8220;last”的羃å†?/span>
但是它在两个å表辑ּ里的å«ä¹‰æ˜¯ä¸åŒçš„ã€?/span>
在天åQˆæœˆåQ‰å表达å¼ä¸åQ?#8220;L”表示一个月的最åŽä¸€å¤?,
在天åQˆæ˜ŸæœŸï¼‰è‡ªè¡¨è¾‘Ö¼ä¸ï¼Œ“L”表示一个星期的最åŽä¸€å¤©ï¼Œä¹Ÿå°±æ˜¯SAT
如果åœ?#8220;L”剿œ‰å…·ä½“的内容,它就å…ähœ‰å…¶ä»–çš„å«ä¹‰äº†
例如åQ?#8220;6L”表示˜q™ä¸ªæœˆçš„倒数½W¬ï¼–天,“åQ¦ï¼²åQ©ï¼¬”表示˜q™ä¸ªæœˆçš„æœ€åŽä¸€ä¸ªæ˜ŸæœŸäº”
注æ„åQšåœ¨ä½¿ç”¨“L”傿•°æ—Óž¼Œä¸è¦æŒ‡å®šåˆ—表或范å›ß_¼Œå› 䨓˜q™ä¼šå¯ÆD‡´é—®é¢˜
============================================
CronTriggeré…ç½®å®Œæ•´æ ¼å¼ä¸ºï¼š [¿U’] [分] [ž®æ—¶] [æ—¥] [月] [周] [òq´]
åºå· | 说明 | 是å¦å¿…å¡« | å…许填写的å€?/td> | å…许的通酽W?/td> |
1 | ¿U?/td> | æ˜?/td> | 0-59 | , - * / |
2 | �/td> | �/td> | 0-59 | , - * / |
3 | ž®æ—¶ | æ˜?/td> | 0-23 | , - * / |
4 | �/td> | �/td> | 1-31 | , - * ? / L W |
5 | �/td> | �/td> | 1-12 or JAN-DEC | , - * / |
6 | �/td> | �/td> | 1-7 or SUN-SAT | , - * ? / L # |
7 | òq?/td> | å?/td> | empty æˆ?1970-2099 | , - * / |
通酽W¦è¯´æ˜?
* 表示所有å€? 例如:在分的嗌Dµä¸Šè®„¡½® "*",表示æ¯ä¸€åˆ†é’Ÿéƒ½ä¼šè§¦å‘ã€?br />? è¡¨ç¤ºä¸æŒ‡å®šå€¹{€‚ä‹É用的场景ä¸ÞZ¸éœ€è¦å…³å¿ƒå½“å‰è®¾¾|®è¿™ä¸ªå—ŒD늚„倹{€‚例å¦?è¦åœ¨æ¯æœˆçš?0寂§¦å‘一个æ“作,但ä¸å…›_¿ƒæ˜¯å‘¨å‡ ,所以需è¦å‘¨ä½ç½®çš„那个嗌Dµè®¾¾|®äØ“"?" 具体讄¡½®ä¸?0 0 0 10 * ?
- 表示区间。例å¦?åœ¨å°æ—¶ä¸Šè®„¡½® "10-12",表示 10,11,12炚wƒ½ä¼šè§¦å‘ã€?br />, 表示指定多个å€û|¼Œä¾‹å¦‚åœ¨å‘¨å—æ®µä¸Šè®¾¾|?"MON,WED,FRI" 表示周一åQŒå‘¨ä¸‰å’Œå‘¨äº”触å‘
/ 用于递增触å‘。如在秒上é¢è®„¡½®"5/15" 表示ä»?¿U’开始,æ¯å¢ž15¿U’触å?5,20,35,50)ã€?åœ¨æœˆå—æ®µä¸Šè®¾¾|?1/3'所½Cºæ¯æœ?å·å¼€å§‹ï¼Œæ¯éš”三天触å‘一‹Æ¡ã€?br />L 表示最åŽçš„æ„æ€ã€‚在日嗌Dµè®¾¾|®ä¸ŠåQŒè¡¨½Cºå½“月的最åŽä¸€å¤?便®å½“剿œˆä†¾åQŒå¦‚果是二月˜q˜ä¼šä¾æ®æ˜¯å¦æ˜¯æ¶¦òq´[leap]), åœ¨å‘¨å—æ®µä¸Šè¡¨½Cºæ˜ŸæœŸå…åQŒç›¸å½“于"7"æˆ?SAT"。如果在"L"å‰åŠ ä¸Šæ•°å—,则表½Cø™¯¥æ•°æ®çš„æœ€åŽä¸€ä¸ªã€‚例如在周嗌Dµä¸Šè®„¡½®"6L"˜q™æ ·çš„æ ¼å¼?则表½C?#8220;本月最åŽä¸€ä¸ªæ˜ŸæœŸäº”"
W 表示¼›ÀLŒ‡å®šæ—¥æœŸçš„æœ€˜q‘那个工作日(周一臛_‘¨äº?. ä¾‹å¦‚åœ¨æ—¥å—æ®µä¸Šè®¾¾|?15W"åQŒè¡¨½Cºç¦»æ¯æœˆ15åähœ€˜q‘的那个工作日触å‘。如æž?5åäh£å¥½æ˜¯å‘¨å…åQŒåˆ™æ‰¾æœ€˜q‘的周五(14å?触å‘, 如果15åäh˜¯å‘¨æœªåQŒåˆ™æ‰¾æœ€˜q‘的下周一(16å?触å‘.如果15åäh£å¥½åœ¨å·¥ä½œæ—?周一臛_‘¨äº?åQŒåˆ™ž®±åœ¨è¯¥å¤©è§¦å‘ã€‚å¦‚æžœæŒ‡å®šæ ¼å¼äØ“ "1W",å®ƒåˆ™è¡¨ç¤ºæ¯æœˆ1å·å¾€åŽæœ€˜q‘的工作日触å‘。如æž?åäh£æ˜¯å‘¨å…,则将åœ?å·ä¸‹å‘¨ä¸€è§¦å‘ã€?注,"W"å‰åªèƒ½è®¾¾|®å…·ä½“的数å—,ä¸å…许区é—?-").
# åºå·(è¡¨ç¤ºæ¯æœˆçš„ç¬¬å‡ ä¸ªå‘¨å‡ )åQŒä¾‹å¦‚在周嗌Dµä¸Šè®„¡½®"6#3"è¡¨ç¤ºåœ¨æ¯æœˆçš„½W¬ä¸‰ä¸ªå‘¨å…?注æ„如果指定"#5",æ£å¥½½W¬äº”周没有周å…,则ä¸ä¼šè§¦å‘该é…ç½®(用在æ¯äº²èŠ‚å’Œçˆ¶äº²èŠ‚å†åˆé€‚丘q‡äº†) åQ?br />
ž®æ½Cºï¼š
'L'å’?'W'å¯ä»¥ä¸€¾l„åˆä½¿ç”¨ã€‚如果在日嗌Dµä¸Šè®„¡½®"LW",则表½Cºåœ¨æœ¬æœˆçš„æœ€åŽä¸€ä¸ªå·¥ä½œæ—¥è§¦å‘åQ?br />周嗌D늚„讄¡½®åQŒè‹¥ä½¿ç”¨è‹±æ–‡å—æ¯æ˜¯ä¸åŒºåˆ†å¤§å°å†™çš„åQŒå³MON 与mon相åŒåQ?/tt>
常用½CÞZ¾‹:
0 0 12 * * ? | æ¯å¤©12点触å?/td> |
0 15 10 ? * * | æ¯å¤©10ç‚?5分触å?/td> |
0 15 10 * * ? | æ¯å¤©10ç‚?5分触å?/td> |
0 15 10 * * ? * | æ¯å¤©10ç‚?5分触å?/td> |
0 15 10 * * ? 2005 | 2005òq´æ¯å¤?0ç‚?5分触å?/td> |
0 * 14 * * ? | æ¯å¤©ä¸‹åˆçš?2点到2ç‚?9分æ¯åˆ†è§¦å?/td> |
0 0/5 14 * * ? | æ¯å¤©ä¸‹åˆçš?2点到2ç‚?9åˆ?整点开始,æ¯éš”5分触å? |
0 0/5 14,18 * * ? | æ¯å¤©ä¸‹åˆçš?2点到2ç‚?9分ã€?8点到18ç‚?9åˆ?整点开始,æ¯éš”5分触å? |
0 0-5 14 * * ? | æ¯å¤©ä¸‹åˆçš?2点到2ç‚?5分æ¯åˆ†è§¦å?/td> |
0 10,44 14 ? 3 WED | 3月分æ¯å‘¨ä¸‰ä¸‹åˆçš„ 2ç‚?0分和2ç‚?4分触å?/td> |
0 15 10 ? * MON-FRI | 从周一到周五æ¯å¤©ä¸Šåˆçš„10ç‚?5分触å?/td> |
0 15 10 15 * ? | æ¯æœˆ15å·ä¸Šå?0ç‚?5分触å?/td> |
0 15 10 L * ? | æ¯æœˆæœ€åŽä¸€å¤©çš„10ç‚?5分触å?/td> |
0 15 10 ? * 6L | æ¯æœˆæœ€åŽä¸€å‘¨çš„æ˜ŸæœŸäº”çš„10ç‚?5分触å?/td> |
0 15 10 ? * 6L 2002-2005 | ä»?002òq´åˆ°2005òq´æ¯æœˆæœ€åŽä¸€å‘¨çš„æ˜ŸæœŸäº”çš„10ç‚?5分触å?/td> |
0 15 10 ? * 6#3 | æ¯æœˆçš„第三周的星期五开始触å?/td> |
0 0 12 1/5 * ? | æ¯æœˆçš„第一个ä¸åˆå¼€å§‹æ¯éš?天触å‘一‹Æ?/td> |
0 11 11 11 11 ? | æ¯å¹´çš?1æœ?1å?11ç‚?1分触å?å…‰æ£èŠ? |