admin管理员组文章数量:1122832
Is it possible to set Spring Scheduler to run every month when there are six days left until the end of the month ?
If so, what would be the CRON expression for this to happen ?
Is it possible to set Spring Scheduler to run every month when there are six days left until the end of the month ?
If so, what would be the CRON expression for this to happen ?
Share Improve this question edited Nov 22, 2024 at 9:34 Francesco Poli 1,2748 silver badges16 bronze badges asked Nov 22, 2024 at 8:48 MykoliuxMykoliux 1134 silver badges7 bronze badges1 Answer
Reset to default 4Since Spring 5.3, CronExpression
supports L
as the last day of the month. So you can use this kind of expression for your case:
0 0 0 L-6 * *
This will run at midnight 6 days before the end of month, accordingly to https://crontab.cronhub.io/
Check also this pages:
https://spring.io/blog/2020/11/10/new-in-spring-5-3-improved-cron-expressions
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/support/CronExpression.html
本文标签:
版权声明:本文标题:java - Setting Spring Scheduler to run every month when there are six days left until the end of the month - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305072a1932460.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论