Spring Boot 定时任务的使用
2017-08-01 20:13
435 查看
本文介绍在 Spring Boot 中怎样使用定时任务,使用很easy,就不做过多说明了。
以下是代码类:
以下是代码类:
package org.springboot.sample.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; /** * 定时任务配置类 * * @author 单红宇(365384722) * @myblog http://blog.csdn.net/catoop/ * @create 2016年3月21日 */ @Configuration @EnableScheduling // 启用定时任务 public class SchedulingConfig { private final Logger logger = LoggerFactory.getLogger(getClass()); @Scheduled(cron = "0/20 * * * * ?") // 每20秒运行一次 public void scheduler() { logger.info(">>>>>>>>>>>>> scheduled ... "); } }
相关文章推荐
- Springboot之使用Scheduled做定时任务
- Spring Boot 定时任务的使用
- 在Spring Boot中使用@Scheduled实现定时任务
- (14)Spring Boot定时任务的使用【从零开始学Spring Boot】
- Spring Boot定时任务的使用方法
- Spring Boot:在Spring Boot中使用定时任务
- Spring Boot:在Spring Boot中使用定时任务
- Spring Boot:在Spring Boot中使用定时任务
- SpringBoot使用SpringTask实现定时任务
- springboot使用定时任务、异步
- spring boot中定时任务的使用
- Spring Boot 定时任务的使用
- SpringBoot(十四)_springboot使用内置定时任务Scheduled的使用(一)
- 使用 Spring-boot 的 @Scheduled 来完成一个定时任务
- Springboot使用定时任务,Spring Schedule
- Spring Boot中使用@Scheduled创建定时任务
- (14)Spring Boot定时任务的使用【从零开始学Spring Boot】
- SpringBoot实践之---定时任务scheduled的使用
- Spring Boot定时任务的使用实例代码
- 在Spring Boot中使用@Scheduled实现定时任务