@Service
public class TimerTask{
private static final Logger logger = LoggerFactory.getLogger(TimerTask.class);
@Scheduled(cron="${push.task.cron}") //动态获取配置文件中 push.task.cron=0 59 16 30 10 ?
public void index(){
logger.info("==========定时任务执行中========");
}
}
spring*.xml配置文件添加
<task:annotation-driven />