- 需要的包spring-context-4.3.9.RELEASE.jar
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @描述: 定时启动
*/
@Component
public class AutoMarkAndGenerateReport {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Scheduled(fixedRate=30*60*1000)//30分钟执行一次
public void markAndGenerateReport(){
logger.info("--启动定时器--");
}
}