1. 在Application.java中开启定时输出注解@EnableScheduling
    springboot测试定时输出
  2. 在service层写一个方法,方法上加入@Scheduled注解,注解中写cron表达式,表达式总共6个参数,分别是 秒 分 时 日 月 星期,这里我的测试的内容就是在每个月每一天,无论周一到周日的11.37都执行这个方法
    springboot测试定时输出
  3. 运行Application方法


    springboot测试定时输出springboot测试定时输出

相关文章:

  • 2022-12-23
  • 2022-01-22
  • 2021-09-28
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2021-10-10
  • 2022-01-19
猜你喜欢
  • 2021-05-04
  • 2021-07-16
  • 2021-07-18
  • 2022-12-23
  • 2021-11-27
  • 2021-09-02
相关资源
相似解决方案