小虎j2ee歷程

          小虎的小小收集

          常用鏈接

          統(tǒng)計(jì)

          最新評(píng)論

          spring定時(shí)器

          1.要下載一個(gè)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) 評(píng)論(0)  編輯  收藏


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 阿克苏市| 大英县| 恭城| 富阳市| 资源县| 乌拉特前旗| 陇川县| 峨边| 五华县| 江永县| 伊宁市| 秦皇岛市| 塔城市| 丰宁| 清徐县| 浑源县| 蒙阴县| 莱西市| 宁乡县| 峨眉山市| 古丈县| 定南县| 望都县| 新和县| 武鸣县| 吴旗县| 丽江市| 梁山县| 望都县| 绩溪县| 曲水县| 新邵县| 中西区| 资溪县| 大姚县| 韶关市| 平武县| 米泉市| 汾阳市| 固阳县| 嘉荫县|