java 定时任务

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class ScheduledService {
private static final Logger log = LoggerFactory.getLogger(ScheduledService.class);

/**
 * 每天凌晨执行一次 
 */
@Scheduled(cron = "0 0 0 * * ?")
public void scheduled(){

}

}

上一篇:Where does the setting xx-bindingSuntax - complex take effect


下一篇:SpringBoot 定时器详解