import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
@EnableScheduling
@EnableAsync
@Slf4j
@Component
public class HelloSchedule {
@Scheduled(cron = "* * * ? * 7")
@Async
public void hello() {
log.info("hello....");
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-11396.html