spring Scheduler - 每周运行一次

标签 spring spring-boot

我必须编写一个每周运行一次的 spring 调度程序,比如每周一凌晨 1 点。它的 cron 表达式是什么,我们可以使用 fixedDely 来归档它。

最佳答案

您可以为此使用 cron:

@Scheduled(cron = "0 0 1 * * MON")

cron 表达式从左到右的顺序是:
second, minute, hour, day of month, month, day(s) of week

关于spring Scheduler - 每周运行一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50296823/

相关文章:

java - 无法获取 R2DBC 连接 Java Spring

java - Springboot 可执行 JAR - 错误 : Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

java - 在 Spring 中如何审计端点通信?

java - Spring AuthenticationAuditListener 添加有关目标 URL 的信息

java - 使用 hibernate spring boot 更新数据库架构

Spring Boot ServletRegistrationBean 和部署到外部 Tomcat

java - 如何在 Spring Boot 应用程序上启用 Bearer 身份验证?

spring - 删除 gemfire 缓存中的查询?

spring - @scope 注释的proxyMode 和上下文组件扫描的scoped Proxy 之间的区别。?

java - 如何创建从内存到数据库的后写缓存?