• spring quartz开发中使用demo


    1.首先在pom.xml中配置quartz的jar:

    <!--定时器-->
    <dependency>
    <groupId>org.quartz-scheduler</groupId>
    <artifactId>quartz</artifactId>
    <version>1.8.5</version>
    </dependency>

    2.然后在spring-mvc.xml中配置:

    <!-- =====================日常任务job========================== -->
    <bean id="DailyTaskQtzJob" class="com.geese.inout.util.Quartz">
    </bean>
    <bean id="DailyTaskQtzJobMethod"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    <property name="targetObject">
    <ref bean="DailyTaskQtzJob" />
    </property>
    <property name="targetMethod">
    <value>quartz</value>
    </property>
    </bean>

    <!-- ======================== 调度触发器 ======================== -->
    <bean id="DailyTaskCronTriggerBean" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail" ref="DailyTaskQtzJobMethod"></property>
    <!-- 每天下午16:30触发 -->
    <property name="cronExpression" value="0 38 16 ? * *"></property>
    </bean>

    <!-- ======================== 调度工厂 ======================== -->
    <bean id="SpringJobSchedulerFactoryBean"
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="DailyTaskCronTriggerBean" />
    </list>
    </property>
    </bean>

    3.最后在对应的util类里面写对应的操作方法,一般就是插入数据到对应的记录表中

  • 相关阅读:
    iOS Provision 要点记录
    (FIFO)有名管道在无亲缘进程间的通信
    uuid Makefile share
    浅谈C语言中的联合体
    消息队列 进程通信
    onvif makefile without share
    共享内存 进程通信
    共享内存(非map) 进程通信
    消息队列 两个进程
    linux 进程通信
  • 原文地址:https://www.cnblogs.com/dzcWeb/p/7000261.html
Copyright © 2020-2023  润新知