小虎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)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 仙桃市| 景洪市| 高邮市| 改则县| 贵阳市| 武平县| 大英县| 本溪市| 桑植县| 特克斯县| 微山县| 漯河市| 常德市| 峨眉山市| 元朗区| 乌兰察布市| 灵山县| 民权县| 罗田县| 高淳县| 霍州市| 桃园市| 南郑县| 蕲春县| 塔河县| 察隅县| 中江县| 明水县| 礼泉县| 青浦区| 昌平区| 修武县| 丰台区| 社旗县| 威信县| 南涧| 曲周县| 潍坊市| 秭归县| 东方市| 永寿县|