
定时任务
zqbi
这个作者很懒,什么都没留下…
展开
-
quartz与springTask的定时任务
定时任务 一、springTask定时任务 1)新建类,使用注解@Component与@org.springframework.scheduling.annotation.EnableScheduling打在类上 2)新建执行方法:使用注解@org.springframework.scheduling.annotation.Scheduled(cron = "0 0 0 * * ?")(每天晚上12点执行);cron表达式可以在线生成,不会写也没有关系;但是注意只有六位,不支持年 秒 分 时 日 月 周原创 2021-02-05 18:18:11 · 514 阅读 · 0 评论 -
Quartz定时任务中注入service业务层接口
假装有标题 1)创建类implements org.springframework.context.ApplicationContextAware接口,重写setApplicationContext方法;类打上注解@org.springframework.stereotype.Component 2)代码如下: @org.springframework.stereotype.Component public class SpringTest implements org.springframework.co原创 2021-02-06 14:51:17 · 685 阅读 · 1 评论