小虎j2ee歷程

          小虎的小小收集

          常用鏈接

          統(tǒng)計

          最新評論

          spring定時器

          1.要下載一個quarz.jar包
          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: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.0.xsd
                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
                      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
            
            <bean id="testQuarz" class="com.san.report.RepostQuarz"/>
                
           
            <bean id="quartzDetail"
            class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
             <property name="targetObject">
              <ref bean="testQuarz"/>
             </property>
              <property name="targetMethod">
              <value>Quarzprint</value>
             </property>
           </bean>

             <bean id="quartzDetail1"
            class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
             <property name="targetObject">
              <ref bean="testQuarz"/>
             </property>
              <property name="targetMethod">
              <value>Quarzprint1</value>
             </property>
           </bean>
              <bean id="quartzDetail2"
            class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
             <property name="targetObject">
              <ref bean="testQuarz"/>
             </property>
              <property name="targetMethod">
              <value>Quarzprint2</value>
             </property>
           </bean>
           
            <bean id="quartzTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
             <property name="jobDetail">
              <ref bean="quartzDetail"/>
             </property>
              <property name="cronExpression">
                <value>0 * 17 * * ?</value>
             </property>
           </bean>

            <bean id="quartzTrigger1" class="org.springframework.scheduling.quartz.CronTriggerBean">
             <property name="jobDetail">
              <ref bean="quartzDetail1"/>
             </property>
              <property name="cronExpression">
                <value>0 05 17 17 * ?</value>
             </property>
           </bean>

            <bean id="quartzTrigger2" class="org.springframework.scheduling.quartz.CronTriggerBean">
             <property name="jobDetail">
              <ref bean="quartzDetail2"/>
             </property>
              <property name="cronExpression">
                <value>0 01 17 ? * MON</value>
             </property>
           </bean>
           
            <bean  id="scheduler"  class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                <property name="triggers">
                <list>
                  <ref local="quartzTrigger"/>
            <ref local="quartzTrigger1"/>
            <ref local="quartzTrigger2"/>
                </list>
               </property>
            </bean>
          </beans>

          posted on 2007-12-18 17:50 小虎虎 閱讀(284) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 奈曼旗| 新宁县| 云和县| 集安市| 仙游县| 山西省| 乳山市| 娱乐| 弋阳县| 吉木乃县| 孟连| 忻州市| 郑州市| 泽库县| 嘉峪关市| 新晃| 金秀| 呼图壁县| 盘山县| 云霄县| 东光县| 合阳县| 天气| 毕节市| 蕲春县| 宿松县| 海兴县| 九龙坡区| 嘉禾县| 沧州市| 柏乡县| 雅江县| 呼玛县| 榆林市| 广州市| 清镇市| 长海县| 开平市| 稷山县| 闽侯县| 沂源县|