小虎j2ee歷程

          小虎的小小收集

          常用鏈接

          統計

          最新評論

          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 小虎虎 閱讀(285) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 阿尔山市| 辽宁省| 文山县| 吴桥县| 东平县| 宝应县| 循化| 保康县| 辽源市| 平武县| 寿阳县| 怀集县| 新晃| 乌兰察布市| 克拉玛依市| 固镇县| 宁乡县| 名山县| 拉萨市| 壤塘县| 甘谷县| 普安县| 蒙自县| 华宁县| 犍为县| 淮滨县| 静安区| 卓资县| 渭南市| 潮安县| 克东县| 融水| 鹿邑县| 嘉兴市| 留坝县| 海安县| 峨眉山市| 黄冈市| 白水县| 西乌珠穆沁旗| 开远市|