<bean id="timerTaksBean"  
    class="org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean">   
    <property name="targetObject" ref="scrAction"></property>   
    <property name="targetMethod" value="timeDel"></property>   
</bean>   
<!-- 任务的执行 -->   
<bean id="scheduledTimerTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">   
    <property name="timerTask" ref="timerTaksBean"></property>   
    <property name="period" value="1000"></property>   
    <property name="delay" value="1000"></property>   
</bean>   
<!-- 注册任务 -->   
<bean id="timerFactoryBean" class="org.springframework.scheduling.timer.TimerFactoryBean">   
    <property name="scheduledTimerTasks">   
        <list>   
            <ref bean="scheduledTimerTask" />   
        </list>   
    </property>   
</bean>   

解决方案 »

  1.   

    启动服务器时  根本找不到那个action 
      

  2.   

    <?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:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.springframework.org/schema/context
               http://www.springframework.org/schema/context/spring-context-2.5.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="triggerUtil" class="cn.itcast.utils.timer.Triger"/>
    <bean id="triggerUtil2" class="cn.itcast.utils.timer.Trigers"/>
    <!-- 指定任务(方法) -->
    <bean id="expDataBaseJob"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <!-- 调用的任务类 -->
    <property name="targetObject">
    <ref local="triggerUtil" />
    </property>
    <!-- 调用的方法 -->
    <property name="targetMethod">
    <value>test</value>
    </property>
    </bean>
    <bean id="expDataBaseJob2"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <!-- 调用的任务类 -->
    <property name="targetObject">
    <ref local="triggerUtil2" />
    </property>
    <!-- 调用的方法 -->
    <property name="targetMethod">
    <value>test2</value>
    </property>
    </bean>
    <!-- 设定计划执行时间 -->
    <bean id="expDataBaseTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
    <ref local="expDataBaseJob" />
    </property>
    <property name="cronExpression">
    <value>0 * 16 * * ?</value>
    </property>
    </bean>
    <!-- 设定计划执行时间 -->
    <bean id="expDataBaseTrigger2" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
    <ref local="expDataBaseJob2" />
    </property>
    <property name="cronExpression">
    <value>0 * 16 * * ?</value>
    </property>
    </bean>
    <!-- 任务执行器配置 集合 -->
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
    <list>
    <ref local="expDataBaseTrigger" />
    <ref local="expDataBaseTrigger2" />
    </list>
    </property>
    </bean>
    </beans>
      

  3.   

    额  用quartz的话 是不是要引入包啊