<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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">
<!-- 任务调度配置 --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~作业配置~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<bean id="quartzJob" class="com.spring.quartz.SendMailJob"></bean> <!-- ~~~~~~~~~~~~~~~~~~~~~~~JobDetail配置~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<bean id="jobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 针对作业 -->
<property name="targetObject" ref="quartzJob" />
<property name="targetMethod" value="doSomeThing" />
<property name="concurrent" value="false"/>
</bean> <!-- ~~~~~~~~~~~~~~~~ 触发器配置Trigger ~~~~~~~~~~~~~~~ -->
<!-- 采用Cron Trigger -->
<bean id="cronTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="jobDetail" />
</property>
<!-- cron表达式 -->
<property name="cronExpression">
<value>0/1 * * ? * *</value>
</property>
</bean>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~Scheduler 调控程序~~~~~~~~~~~~~~~~~~~~~-->
<bean id="start_common"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
</beans>这是我spring配置文件,但是呢启动之后Job不自动运行package com.spring.quartz;import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;public class SendMailJob { private static Log log = LogFactory.getLog(SendMailJob.class); public void doSomeThing(){ //JobDetail jobDetail = context.getJobDetail(); log.info("~~~~~~~开始Execute Job: " +"" + "~~~~~~~");
log.info("~~~~~~~~~~~~~~~~~~~~事情办完了~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}}这是job代码!
谁帮帮忙!
解决方案 »
- hibernate 问题
- struts2的jsp页的循环输出数据代码解释
- 密码策略问题 - 求个编程思路
- 文件无法检入到ClearCase,请帮忙看下是什么原因?
- EJB3.0保存数据时报异常:org.hibernate.StaleStateException
- 如何封装JDBC更简单,更好用
- struts2 奇怪的问题 ? 不知道大家碰到过否? 求助!
- 文字显示格式(急!)
- HttpServletRequest的问题
- java 程序员转 php 、 andriod 你会选哪一个
- 如何使用memcashed存放session信息?
- webServices传输数据时发生丢数据现象,本地传输也是,为什么?
采用spring配置就不用实现了