您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Spring Boot实现定时任务的java代码实例

2024/4/1 4:20:10发布9次查看
这篇文章主要介绍了spring boot定时任务的使用实例代码,需要的朋友可以参考下
spring boot中配置定时任务极其简单......下面看下实例代码:
import org.springframework.context.annotation.configuration; import org.springframework.scheduling.annotation.enablescheduling; import org.springframework.scheduling.annotation.scheduled; import java.text.simpledateformat; import java.util.date; /** * created by winner_0715 on 2017/4/18. */ @configuration @enablescheduling public class schedulingconfig { // 每5秒执行一次 @scheduled(cron = "0/5 * * * * ?") public void scheduler() { system.out.println("schedulingconfig.scheduler()" + new simpledateformat("yyyy-mm-dd hh:mm:ss").format(new date())); } }
以上就是spring boot实现定时任务的java代码实例的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product