14. Spring Boot定时任务的使用【从零开始学Spring Boot】

 

【视频 & 交流平台】

à SpringBoot视频

http://study.163.com/course/introduction.htm?courseId=1004329008&utm_campaign=commission&utm_source=400000000155061&utm_medium=share

à SpringCloud视频

http://study.163.com/course/introduction.htm?courseId=1004638001&utm_campaign=commission&utm_source=400000000155061&utm_medium=share

à Spring Boot源码

https://gitee.com/happyangellxq520/spring-boot

à Spring Boot交流平台

http://412887952-qq-com.iteye.com/blog/2321532

 

 

本文介绍在 Spring Boot 中如何使用定时任务,使用非常简单,就不做过多说明了。

com.kfit.base.scheduling.SchedulingConfig:

package com.kfit.base.scheduling;

 

import org.springframework.context.annotation.Configuration;

import org.springframework.scheduling.annotation.EnableScheduling;

import org.springframework.scheduling.annotation.Scheduled;

 

/**

 * 定时任务

 * @author Administrator

 *

 */

@Configuration

@EnableScheduling

public class SchedulingConfig {

   

    @Scheduled(cron = "0/20 * * * * ?") // 20秒执行一次

    public void scheduler() {

        System.out.println(">>>>>>>>> SchedulingConfig.scheduler()");

    }

}

 

【视频&交流平台】

à Spring Boot视频

http://study.163.com/course/introduction.htm?courseId=1004329008

à Spring Cloud视频

http://study.163.com/course/introduction.htm?courseId=1004638001

à Spring Boot源码

https://gitee.com/happyangellxq520/spring-boot

à Spring Boot交流平台

http://412887952-qq-com.iteye.com/blog/2321532

  

 

网易云课堂视频最新更新

第十一章 Spring Boot 日志

1、spring boot日志—理论

2、Spring Boot日志-logback

3、Spring Boot日志-log4j2

第十二章 Spring Boot 知识点2

1、spring boot 服务配置和部署

2、Spring Boot 定制URL匹配规则

 

 

猜你喜欢

转载自412887952-qq-com.iteye.com/blog/2292103
今日推荐