@Scheduled 注解 ,主要配置方式 有 cron fixedDelay等,我把配置放到了application.yml,方便修改
schedule:
enabled: true
poolSize: 10
syncHisOriginData:
cron: 0/1 * * * * ? # - 表示停止此定时任务
delay: "1000"
@Scheduled(fixedDelayString = "${schedule.syncHisOriginData.delay}")
我的情况,cron 和 fixedDelayString 一起写,cron 写 “-”,然后就报错了:Encountered invalid @Scheduled method 'execute': Exactly one of the 'cron', 'fixedDelay(String)', or 'fixedRate(String)' attributes is required,由此写一个配置;为什么要这么设计,配置可以写多个,然后设置个优先级这样会不会更好点