1、创建定时类

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; @Component
public class FlightTrainTask {
@Scheduled(cron = "0/5 * * * * ? ") // 间隔5秒执行
public void taskCycle() {
System.out.println("使用SpringMVC框架配置定时任务");
}
}

  

2、在spring的配置xml文件中开启定时选项

<task:annotation-driven />
<context:component-scan base-package="com.timer" /> //定时器所在文包

  

springMvc 添加定时任务的更多相关文章

  1. springmvc添加定时任务

    springmvc.xml文件中添加如下配置 <bean id="ClearTempRoomLogTask" class="com.test.listener.St ...

  2. LINUX 添加定时任务

    LINUX 添加定时任务 crontab - l按 i:x 先按 esc然后 敲入 命令 :x*/5 3 * * 0 /root/ v.sh ..重启服务 service crond restart

  3. Quartz动态添加定时任务执行sql(服务启动添加+手动添加)

    系统用来每天插入视图数据... 一.数据库表设计 1.接口配置表(t_m_db_interface_config) 2.接口日志表(t_m_db_interface_log) 3.前端配置页面 查询页 ...

  4. SpringBoot - 添加定时任务

    SpringBoot 添加定时任务 EXample1: import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.spri ...

  5. linux添加定时任务crond

    1.crontab –e:编辑当前定时任务 保存完重新crond : service crond restart 2. crontab用法 crontab –e : 修改 crontab 文件,如果文 ...

  6. OSX系统添加定时任务 Linux crontab命令 定时执行py 文件 任务

    #输出日志 #将日志输入到2.log文件中无论错误还是正确02 15 * * * . ~/xad/pyenv/xadserver/bin/activate && cd /root/xa ...

  7. spring--mvc添加用户及用户头像上传

    spring--mvc添加用户及用户头像上传 添加用户步骤: 1.用ajax获取省份信息 2.添加用户 代码:register.jsp <meta http-equiv="Conten ...

  8. elastic-job动态添加定时任务

    在elastic-job的使用过程中,我们会遇到动态添加定时任务的时候,但是官网上面并没有对这块内容进行说明.按照我的理解以及官网上面elastic-job的框架图,ej的定时任务其实是存储在zook ...

  9. Celery 分布式任务队列快速入门 以及在Django中动态添加定时任务

    Celery 分布式任务队列快速入门 以及在Django中动态添加定时任务 转自 金角大王 http://www.cnblogs.com/alex3714/articles/6351797.html ...

随机推荐

  1. Reporting Services无法连接ORACLE,提示:System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本

    Reporting Services无法连接ORACLE,在服务器安装ORACLE 11客户端版本后仍然提示以下错误: System.Data.OracleClient 需要 Oracle 客户端软件 ...

  2. 为组件设定UI

    -----------------siwuxie095                             工程名:CustomizeSwing 包名:com.siwuxie095.swing 类 ...

  3. Win10 上 安装Arduino 驱动 和 Arduino IDE 1.6.9

    Win10 安装Arduino IDE软件 和 驱动 在Win10 上安装最新的Arduino IDE (1.6.9安装包)很简单,并且不行要手动安装Arduino板子的驱动,整个安装过程都当前的简单 ...

  4. Centos下添加/删除用户

    useradd具体参数 [root@yhwang ~] useradd -h Usage: useradd [options] LOGIN useradd -D useradd -D [options ...

  5. kafka之c接口常用API------librdkafka

    1 安装方法以及相关库文件 https://github.com/edenhill/librdkafka 2 High-level producer High-level consumer Simpl ...

  6. 第五课5、ROS客户端2

    1.简单的主题(topic)发布者和主题订阅者: 编写主题发布者节点需要: a.初始化ROS系统: b.广播消息:在foo主题上发布Foo_type_msg类型的消息 c.指定频率发布消息到foo主题 ...

  7. ps&CPU

    #include <pthread.h> void f();int main() {        f();        return 0;} void f() {        int ...

  8. 【转】solr源码导入eclipse

     http://blog.csdn.net/vltic/article/details/19917377   (1)相应的开发环境准备          (1)jdk1.6+的安装和环境变量配置(命令 ...

  9. 1.jQuery入口函数 与javaScript入口函数

    1.jQuery入口函数 与javaScript入口函数 JQ入口函数: $(document).ready(function(){ }); 或者 $(function(){ }) Js入口函数: w ...

  10. Unity -- AssetBundle(本地资源加载和加载依赖关系)

    1.本地资源加载 1).建立Editor文件夹 2).建立StreamingAssets文件夹和其Windows的子文件夹 将下方第一个脚本放入Editor 里面 脚本一  资源打包AssetBund ...