spring boot使用任务调度
来源:互联网 发布:闲鱼 淘宝二手ipad 编辑:程序博客网 时间:2024/05/01 10:47
package com.kingwootec.common;import com.alibaba.dubbo.common.logger.LoggerFactory;import org.apache.log4j.Logger;import org.springframework.scheduling.annotation.Scheduled;import org.springframework.stereotype.Component;import java.text.SimpleDateFormat;import java.util.Date;/** * Created by draco
* email:wanglei198428@163.com */@Componentpublic class ScheduledTasks { // private static final Logger log = (Logger) LoggerFactory.getLogger(ScheduledTasks.class); protected org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(getClass()); @Scheduled(fixedRate = 4000) //用于设置任务间隔 public void reportCurrentTime() { logger.info("reportCurrentTime"); } @Scheduled(fixedDelay=5000)//可使用多个
public void doSomething() { logger.info("doSomething"); }}
package com.kingwootec;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.context.annotation.ImportResource;import org.springframework.scheduling.annotation.EnableScheduling;/** * Created by ddv on 2016/11/21. */@SpringBootApplication@EnableScheduling//在@Configuration注解的类上添加@EnableScheduling注解,为@Scheduled提供调度支持@ImportResource("applicationContent.xml")public class WebApp { public static void main(String[] args) { SpringApplication.run(WebApp.class, args); }}
0 0
- spring boot使用任务调度
- Spring-boot使用Quartz实现多线程调度任务
- spring boot异步(Async)任务调度
- Spring Boot任务调度简单入门
- spring任务调度的使用
- Spring Boot -- Spring的任务调度Spring Task
- Spring学习:使用Spring调度任务
- Spring学习:使用Spring调度任务
- Spring学习:使用Spring调度任务
- spring boot 自学笔记(六) Schedule调度任务
- 【转载】基于Spring Boot + Quartz 的分布式任务调度系统
- Spring中使用Quartz任务调度
- spring 使用注解来调度定时任务
- spring 使用注解来调度定时任务
- 任务调度4-------Spring中使用Quarz
- Spring框架使用作业任务调度Quartz
- spring 使用注解来调度定时任务
- Spring中使用CronTrigger进行任务调度
- hadoop提交作业报错:InvalidAuxServiceException: The auxService:mapreduce_shuffle does not exist
- Spring Cloud构建微服务架构(一)服务注册与发现
- MySQL创建数据表时设定引擎MyISAM/InnoDB
- 8天学通MongoDB——第一天 基础入门
- tensorflow学习笔记(三十):tf.gradients 与 tf.stop_gradient()
- spring boot使用任务调度
- toLocaleString、toString、unshift、values
- 短信平台接口事例
- com.control
- 257. Binary Tree Paths
- ubuntu挂载新硬盘
- 微信公众号登录 Laravel版
- PHP删除Array数组里指定的key
- 算法:Python实现dijkstra最短路由