| | |
| | | package com.zy.system.timer; |
| | | |
| | | import com.zy.common.properties.SchedulerProperties; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 定时任务读取配置信息 |
| | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private SchedulerProperties schedulerProperties; |
| | | |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | public void timer() { |
| | | if (!schedulerProperties.isEnabled()) { |
| | | return; |
| | | } |
| | | tokenExpire = configService.getVal("tokenExpire", Integer.class, tokenExpire); |
| | | tokenNumber = configService.getVal("tokenNumber", Integer.class, tokenNumber); |
| | | logDeleteDays = configService.getVal("logDeleteDays", Integer.class, logDeleteDays); |