springMVC定时任务设置

<?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:tx="http://www.springframework.org/schema/tx"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans   
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd   
    http://www.springframework.org/schema/tx   
    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context-3.0.xsd  
    http://www.springframework.org/schema/mvc  
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
         <!-- 要调用的工作类 -->
	 <bean id="quartzJob" class="com.service.CurrentDataService"></bean>
	 <!-- 定义调用对象和调用对象的方法 -->
	 <bean id="jobtask"
	  class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
		  <!-- 调用的类 -->
		  <property name="targetObject">
		   <ref bean="quartzJob" />
		  </property>
		  <!-- 调用类中的方法 -->
		  <property name="targetMethod">
		   <value>timeTask</value>
		  </property>
	 </bean>
	 <!-- 定义触发时间 -->
	 <bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
		  <property name="jobDetail">
		   <ref bean="jobtask" />
		  </property>
		  <!-- cron表达式 -->
		  <property name="cronExpression">
		   <value>00 55 23 ? * *" </value>
		  </property>
	 </bean>
	  <!-- 总管理类 如果将lazy-init=‘false‘那么容器启动就会执行调度程序 -->
	 <bean id="startQuertz" lazy-init="false" autowire="no"
	  class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		  <property name="triggers">
		   <list>
		    	<ref bean="doTime" />
		    	<ref bean="doTime1" />
		   </list>
		  </property>
	 </bean>
</beans>

这只是用到的一种方法,欢迎补充

时间: 2024-08-18 12:17:26

springMVC定时任务设置的相关文章

PHP Linux定时任务设置

1. crontab中不能保存 运行select-editor 选第二个 nano...然后运行crontab -e根据下面的提示^O写入 以及^X退出程序.或选择3,用vim编辑 配置步骤: 1.Linux下必须编译安装PHP解释器,在安装完成后,要将安装目录下${PHP}/bin/php 文件复制到 /usr/bin/下,并使用chmod +x ./php 为其添加可执行权限,ok了, 然后在linux命令行下输入:php -q *.php 执行一个php程序,以验证是否解释器工作正常 2.

Sql sever 定时任务设置

原文地址http://blog.csdn.net/htl258/article/details/5543694 SQL Server 2008 定时作业的制定--1.打开[SQL Server Management Studio],在[对象资源管理器]列表中选择[SQL Server 代理]:--2.鼠标右击[SQL Server 代理],选择[启动(S)],如已启动,可以省略此步骤:--3.展开[SQL Server 代理]列表,右击[作业]-->[新建作业]:--3.1  在[常规]选项卡中

Oracle ODI 12c之多表联合查询以及定时任务设置

本文介绍如何通过ODI进行多表联合查询并设置定时任务.准备工作如下: 准备物理方案和逻辑方案: 创建模型并通过"逆向工程"同步方案: 创建项目(根据实际情况创建或者使用现有的): 确保源表和目标表都有主键存在.以上内容的前三点可以参考我博客中的相关文章. 一.Preparing 1.1 源SQL语句 SELECT a.ID, a.ORG_ID, a.NAME_ID, a.EVR_ID, a.PACKAGE_ARCH_ID, a.PACKAGE_GROUP, a.RPM_VERSION,

linux定时任务设置

设置定时任务时,需要注意很多细节,如权限,路径,输出日志等等,这里以centOS为例,给出一个执行成功的例子,但实际设置的方法很多,本篇只是作为参考. 登录服务器时是自己的用户名,在/opt/目录下新建一个文件夹,而后把jar包,依赖以及日志的目录新建好,给出权限: sudo chmod -R 777 * 而后书写脚本,脚本内容设置为执行关键jar包,并输出日志,需要注意的是,这里的jar包路径以及日志的路径都必须是绝对路径,否则在定时任务中无法执行: #!/bin/bash /opt/jdk1

linux系统定时任务设置

.使用at命令设置一次性定时任务 2.使用crontab设置周期性定时任务 1)cd /home 目录下,使用vi test.py创建文件,内容如下: #!/usr/bin/python#coding=utf-8 import timef=open('f.txt','w')now = time.strftime('%Y-%m-%d-%H_%M_%S',time.localtime(time.time()))f.write('file run time:'+now+'\n') f.close()

SpringMVC国际化设置-Cannot change HTTP accept header - use a different locale resolution strategy

使用SpringMVC3配置国际化,最近遇到了"Cannot change HTTP accept header - use a different locale resolution strategy" 这样的异常提示,最终解决了.现在来说说有关SpringMVC配置国际化的步骤及注意点,最后结合Spring源码解析下原理. 国际化最常需要解决的问题 页面上能够根据浏览器设置的语言来动态展现文本,数值,时间等: 可以在Bean中获取设置的Locale信息: 可以通过动态链接的方式来切

springMVC参数设置

接收的参数为日期类型 在springmvc的controller控制层接收日期参数时,如果不加以设置,服务器开启后,进入不了页面中,会报错.这个错误就是日期在页面传入到springmvc的controller中的时候没有转化.就会引起错误 解决的方法是,在controller类中加一个方法,如下: @InitBinder public void initBinder(ServletRequestDataBinder binder){ //只要网页中传来的数据格式为yyyy-MM-dd 就会转化为

windows的定时任务设置

windows 的Schedule Task .创建配置 1.点击"開始" 2.点击"控制面板" 3.双击"任务计划" 4.双击"加入任务计划" 5.到了"任务计划向导"界面,点击"下一步" 6.点击"浏览"选择须要定时执行的程序(exe文件,bat文件,com文件,sys文件)然后确定. 7.给此任务取个名称,也能够默认,而且选择多少时间段执行一次程序,点击&quo

Jinkins定时任务设置

设置的地方在构建触发器中 Build after other projects are built:在其他项目构建完成后再进行构建. Build periodically:周期进行构建 Build when a change is pushed to GitHub:当GitHub有版本库更新时触发Jenkins进行构建 Poll SCM:根据SCM软件的版本号,定时检查源码变更.如果有更新,则checkout最新code,然后执行构建动作. 具体如何设置,点开问号就能看到说明.