zoukankan      html  css  js  c++  java
  • spring----定时任务

    配置

    <beans>
    	<!--定义调度器-->
    	<bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
           <!--注释掉 
         <property name="dataSource">
                <ref bean="dataSource"/>
            </property>
            <property name="applicationContextSchedulerContextKey" value="applicationContextKey"/>
            <property name="configLocation" value="classpath:quartz.properties"/>
        -->
            <property name="triggers">
            	<list>
                            <ref bean="hxmxdzTaskTrigger"/>
            	</list>
            </property>	
        </bean>
        
        <!--处理类-->
    	<bean id="hxmxdzTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
            <property name="targetObject" ref="springQuartzTask"/>
            <property name="targetMethod" value="executeTask88"/>
        </bean>
       
        <!--定义触发器-->
        <bean id="hxmxdzTaskTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail" ref="hxmxdzTask"/>
            <!--可循环跑,从晚上9点开始处理,20分钟处理一次,但是只处理到当天晚上11.00-->
          <property name="cronExpression" value="0 0/20 21-23 * * ?"/>
        </bean> 
    </beans>    
      
    

      

    @Component("springQuartzTask")
    public class SpringQuartzTask{
    
    }
    

      

  • 相关阅读:
    ==和===
    Println、Printf、Sprintf区别
    BurpSuite代理https
    scp
    Tomcat Ajp(CVE-2020-1938)
    Chrome-HackBar破解
    crontab
    Sql注入之postgresql
    Sql注入之oracle
    LeetCode简单题(一)
  • 原文地址:https://www.cnblogs.com/yanxiaoge/p/13976670.html
Copyright © 2011-2022 走看看