zoukankan      html  css  js  c++  java
  • quartz spring 整合例子

    1. 引入quartz jar包

    2.application.xml中配置代码:

     <!-- 定义远程调用service down -->
     <bean id="qzetaoGoodsInfoService"
      class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
      <property name="serviceUrl" value="${remote.appUri}/hessian/etaoGoodsInfoService-hessian" />
      <property name="serviceInterface" value="com.luolai.ec.services.fe.passport.IFeEtaoGoodsInfoService" />
     </bean>
     <!-- 定义远程调用service up -->
     <!-- 定义操作BEAN -->
     <bean id="jobtaskCreateEtaoInfo"
      class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
      <property name="targetObject">
       <ref bean="qzetaoGoodsInfoService" />
      </property>
      <property name="targetMethod">
       <value>createIncrementIndex</value>
      </property>
      
     </bean>
     <bean id="doCreateEtaoInfo" class="org.springframework.scheduling.quartz.CronTriggerBean">
      <property name="jobDetail">
       <ref bean="jobtaskCreateEtaoInfo" />
      </property>
      <property name="cronExpression">
        <!-- 每隔1小时执行一次-->
                 <value>0 0 0/1 * * ?</value>
      </property>
     </bean>

    真正的spring调用定时程序

    <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->

    <bean id="scheduler" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
      <property name="triggers">
       <list>
         <ref bean="doCreateEtaoInfo" />
       </list>
      </property>
     </bean>

  • 相关阅读:
    Opencv 中透视变换函数对IplImage图像变换时出现的问题?
    algorithm ch15 FastWay
    LeetCode 151 reverse word in a string
    LeetCode 10 Regular Expression Match
    LeetCode the longest palindrome substring
    MS笔试中的一个关于函数返回的“小”题
    js数组
    js数据强转
    css居中问题
    html table
  • 原文地址:https://www.cnblogs.com/doosmile/p/2595102.html
Copyright © 2011-2022 走看看