import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration
@EnableScheduling
public class OrderPointTask {
@Autowired
private UserPointService userPointService;
// 每五秒执行一次
//@Scheduled(cron = "0/5 * * * * ?")
@Scheduled(cron = "0 0 * * * ?")
public void TaskJob() {
System.out.println("========");
}
}
}
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration
@EnableScheduling
public class OrderPointTask {
@Autowired
private UserPointService userPointService;
// 每五秒执行一次
//@Scheduled(cron = "0/5 * * * * ?")
@Scheduled(cron = "0 0 * * * ?")
public void TaskJob() {
System.out.println("========");
}
}
}