SpringMvc自动任务调度之task实现项目源码,@Scheduled
1.Xml配置 Spring-job.xml 并在 Spring-Application.xml中Import
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:task="http://www.springframework.org/schema/task"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd">
- <description>Spring Configuration</description>
- <context:component-scan base-package="包的根目录例:com.xx.xx"/>
- <!-- 配置任务线性池 -->
- <task:executor id="executor" pool-size="10" />
- <task:scheduler id="scheduler" pool-size="10"/>
- <task:annotation-driven scheduler="scheduler" executor="executor" proxy-target-class="true"/>
- <!-- 如果类文件中没有使用@Scheduled ,可以使用下面的配置 -->
- <!--<task:scheduled-tasks scheduler="scheduler">
- <task:scheduled ref="TestJob" method="test" cron="0/1 * * * * ?"/>
- </task:scheduled-tasks>-->
- </beans>
2.类文件TASK.java
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- @Component("TestJob")
- public class ATask{
- @Scheduled(cron = "0 9 16 * * ?")//每隔5秒隔行一次
- public void test(){
- System.out.println("job1 开始执行。。。。");
- }
- }
然后就可以了;
原文地址:https://blog.csdn.net/zhulin2012/article/details/51916612
SpringMvc自动任务调度之task实现项目源码,@Scheduled的更多相关文章
- java crm 进销存 springmvc SSM 项目 源码 系统
系统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3 SSM ...
- java 进销存管理 商户管理 库存管理 springmvc SSM 项目源码
统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3 SSM 普 ...
- java crm 系统 进销存 springmvc SSM项目项目源码
统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3 SSM 普 ...
- SpringMVC关于json、xml自动转换的原理研究[附带源码分析 --转
SpringMVC关于json.xml自动转换的原理研究[附带源码分析] 原文地址:http://www.cnblogs.com/fangjian0423/p/springMVC-xml-json-c ...
- 反射实体自动生成EasyUi DataGrid模板 第二版--附项目源码
之前写过一篇文章,地址 http://www.cnblogs.com/Bond/p/3469798.html 大概说了下怎么通过反射来自动生成对应EasyUi datagrid的模板,然后贴了很多 ...
- SpringMVC+Maven开发项目源码详细介绍
代码地址如下:http://www.demodashi.com/demo/11638.html Spring MVC概述 Spring MVC框架是一个开源的Java平台,为开发强大的基于Java的W ...
- Java SSM 客户管理 商户 管理系统 库存管理 销售报表 项目源码
系统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3 SSM ...
- Java 商户管理系统 客户管理 库存管理 销售报表 SSM项目源码
系统介绍: 1.系统采用主流的 SSM 框架 jsp JSTL bootstrap html5 (PC浏览器使用) 2.springmvc +spring4.3.7+ mybaits3.3 SSM ...
- Java SSM 商户管理系统 客户管理 库存管理 销售报表 项目源码
需求分析: 有个厂家,下面有很多代理商(商户或门头等),之前商户进货.库存.销售.客户资料等记录在excel表格中 或者无记录,管理比较混乱,盈利情况不明.不能有效了解店铺经营情况和客户跟踪记录 厂家 ...
随机推荐
- BZOJ5100 : [POI2018]Plan metra
若$1$到$n$之间没有其它点,则$1$到$n$的距离为任意一点到它们距离的差值,按照距离关系判断每个点是挂在$1$上还是挂在$n$上即可. 否则$1$到$n$的距离只可能为任意一点到它们距离和的最小 ...
- Flask特殊装饰器
@app.errorhandler():重定义错误返回信息 @app.errorhandler(404) #监听多少写多少 def error404(message): return f"你 ...
- 解释Eclipse下Tomcat项目部署路径问题(.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps)
配置eclipse的开发环境,配置jdk的安装路径和tomcat安装路径.在eclipse下建立Dynamic Web Project工程zhgy,在使用eclipse中new一个tomcat,通过启 ...
- vue要点记录(待更新)
Vue实例 每个 Vue 实例都会代理其 data 对象里所有的属性:vm.a===data.a //true 注意只有这些被代理的属性是响应的. 如果在实例创建之后添加新的属性到实例上,它不会触发视 ...
- Error-MVC: 未能找到路径“D:\\DsWeb\DS.Web\dist\bin\roslyn\csc.exe”的一部分。
ylbtech-Error-MVC: 未能找到路径“D:\\DsWeb\DS.Web\dist\bin\roslyn\csc.exe”的一部分. 1.返回顶部 1, “/”应用程序中的服务器错误. 未 ...
- iOS:如何实现在文字上添加拼音
一.介绍 最近项目有一个需求,需要给朗诵的文字添加对应的拼音,而且要求使用原生的控件实现.一开始听到这个需求挺懵逼的,感觉有点难.后来,静下来想一下,其实还是可以实现的,无非就是自定义了.下面,就来说 ...
- Go语言之高级篇beego框架之日志收集系统
一.日志收集系统架构设计 图1 图2 二.开发环境 1.安装jdk jdk-8u51-windows-x64.exe 安装目录:C:\Program Files\jdk8 2.安装zookeeper ...
- tensorflow创建自定义 Estimator
https://www.tensorflow.org/guide/custom_estimators?hl=zh-cn 创建自定义 Estimator 本文档介绍了自定义 Estimator.具体而言 ...
- Docker 下载镜像慢的问题解决方法
让你火箭般的速度下载docker镜像! 的冷漠度 百家号17-11-1713:09 因为有墙的原因所以在国内下载docker镜像的速度非常慢,有时候是几kb每秒,那个蛋疼的等待,真是谁等谁知道!下面我 ...
- go微服务框架go-micro深度学习(五) stream 调用过程详解
上一篇写了一下rpc调用过程的实现方式,简单来说就是服务端把实现了接口的结构体对象进行反射,抽取方法,签名,保存,客户端调用的时候go-micro封请求数据,服务端接收到请求时,找到需要调用调 ...