java – *和*之间的区别?在Spring @Scheduled(cron =“…”)

前端之家收集整理的这篇文章主要介绍了java – *和*之间的区别?在Spring @Scheduled(cron =“…”)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直在查看 Spring Boot示例来安排任务( https://spring.io/guides/gs/scheduling-tasks/)并阅读一些文档( https://javahunter.wordpress.com/2011/05/05/cronscheduler-in-spring/),我看到了*和?几乎互换使用.

例如,行

@Scheduled(cron = "0 15 10 ? * *")

@Scheduled(cron = "0 15 10 * * ?")

做同样的事情.那么*和?之间有什么区别?

解决方法

asterix代表所有可能的值.问号应用于非特定值

*(“all values”) – used to select all values within a field. For example,“” in the minute field means *”every minute”.

? (“no specific value”) – useful when you need to specify something in
one of the two fields in which the character is allowed,but not the
other. For example,if I want my trigger to fire on a particular day
of the month (say,the 10th),but don’t care what day of the week that
happens to be,I would put “10” in the day-of-month field,and “?” in
the day-of-week field. See the examples below for clarification.

tutorial复制

原文链接:https://www.f2er.com/java/124789.html

猜你在找的Java相关文章