`
anyeeye
  • 浏览: 145481 次
  • 来自: ...
社区版块
存档分类
最新评论

SchedulerFactoryBean

阅读更多
<?xml version="1.0" encoding="UTF-8"?><beans><bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false"><property name="startupDelay" value="10"></property><property name="triggers"><list><!-- <ref local="autoQueryCitiesTrigger" /> --><ref local="hotelAutoCancelTrigger"></ref><ref local="timerAuditeTrigger"></ref><ref local="timerAutoChangeStatusTrigger"></ref></list></property></bean><bean id="autoQueryCitiesTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"><property name="jobDetail" ref="autoQueryCitiesJob"></property><property name="repeatInterval" value="30000"></property></bean><bean name="autoQueryCitiesJob" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass" value="com.hnatourism.tdos.scheduler.job.AutoQueryCitiesJobImpl"></property><property name="jobDataAsMap"><map><entry key="hnaProcityManager" value-ref="hnaProcityManager"></entry><!-- <entry key="airportInfoManager" value-ref="airportInfoManager" /> --><entry key="springContextUtil" value-ref="SpringContextUtil"></entry></map></property><property name="applicationContextJobDataKey" value="applicationContext"></property></bean><bean name="autoQueryCitiesManager" class="com.hnatourism.tdos.scheduler.job.AutoQueryCitiesJobImpl"><property name="hnaProcityManager" ref="hnaProcityManager"></property><!-- <property name="airportInfoManager" ref="airportInfoManager" /> --><property name="springContextUtil" ref="SpringContextUtil"></property></bean><bean id="hotelAutoCancelTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"><property name="jobDetail" ref="hotelAutoCancelJob"></property><property name="repeatInterval" value="300000"></property></bean><bean id="timerAuditeTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="timerAuditeJob"></property><property name="cronExpression"><value>0 0 18 * * ?</value><!--每天18点0分0秒 --></property></bean><bean id="timerAutoChangeStatusTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail" ref="timerAutoChangeStatusJob"></property><property name="cronExpression"><value>0 0 0 * * ?</value><!--每天0点0分0秒 --></property></bean><bean name="timerAuditeJob" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass" value="com.hnatourism.tdos.scheduler.job.TimerAuditeJob"></property><property name="applicationContextJobDataKey" value="applicationContext"></property></bean><bean name="timerAutoChangeStatusJob" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass" value="com.hnatourism.tdos.scheduler.job.TimerAutoChangeStatusJob"></property><property name="applicationContextJobDataKey" value="applicationContext"></property></bean><bean name="hotelAutoCancelJob" class="org.springframework.scheduling.quartz.JobDetailBean"><property name="jobClass" value="com.hnatourism.tdos.scheduler.job.AutoCancelOrderJob"></property><property name="jobDataAsMap"><map><entry key="timeOut" value="30"></entry></map></property><property name="applicationContextJobDataKey" value="applicationContext"></property></bean></beans>
分享到:
评论

相关推荐

    spring java 定时器 执行两次 quartz

    &lt;bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; ``` 这里,`configLocation`属性指定了Quartz的配置文件位置,`triggers`属性则指定了需要调度的任务...

    java quartz任务示例

    Java Quartz 是一个强大的开源作业调度框架,用于在Java应用程序中安排和执行任务。它提供了丰富的API,使得开发者能够轻松地创建、管理和执行定时任务。Quartz 支持简单任务到复杂的作业调度,包括触发器、作业、...

    springbootQuartz

    public CronTriggerBean myJobTrigger(SchedulerFactoryBean schedulerFactoryBean, MyJob job) { CronTriggerBean trigger = new CronTriggerBean(); trigger.setJobDetail(job); trigger.setCronExpression("0 ...

    quartz-2.2.2-distribution.rar

    public SchedulerFactoryBean schedulerFactoryBean(JobDetailFactoryBean job, CronTriggerFactoryBean trigger) { SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setJobDetails(new ...

    spring注解Quartz定时执行功能

    SchedulerFactoryBean schedulerFactoryBean = (SchedulerFactoryBean) event.getApplicationContext().getBean("schedulerFactoryBean"); try { schedulerFactoryBean.start(); System.out.println("Quartz ...

    spring quartz通过xml配置实现定时任务demo

    &lt;bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; &lt;!-- 配置JobDetail --&gt; &lt;!-- 将Job实例化时需要的参数注入 --&gt; &lt;!-- 添加你需要传递给Job...

    Spring定时器配置详解

    Spring 定时器配置详解 Spring 定时器是一种基于 Quartz 的任务调度框架,它提供了一个灵活的方式来...通过配置 CronTriggerBean、JobDetailBean 和 SchedulerFactoryBean,可以精确地控制任务的运行时间和执行细节。

    Quartz动态调度示例

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setConfigLocation(new ClassPathResource("quartz.properties")); // 如果有自定义配置文件 factory.setOverwriteExistingJobs(true); // ...

    Spring4集成quartz2.2.1

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setApplicationContext(applicationContext); factory.setJobFactory(new SpringBeanJobFactory()); // 其他配置,如数据库连接等 return...

    spring之quartz定时器

    2. 配置Spring的`SchedulerFactoryBean`,指定Quartz的配置文件路径,如`&lt;bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt;`。 3. 定义JobDetail,包含Job的...

    spring定时调用以及设定时间调用包括jar和源码

    Spring提供了一套完整的定时任务解决方案,其中包括基于`java.util.Timer`的简单定时器,但更为常用的是Spring的`TaskScheduler`和集成Quartz的`SchedulerFactoryBean`。本文将详细探讨Spring的定时任务机制以及...

    spring定时器

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setConfigLocation(new ClassPathResource("quartz.properties")); return factory; } } ``` 除了核心的定时任务功能,Spring Task还...

    Quartz2.2.1基于Spring注解方式配置Quartz

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setOverwriteExistingJobs(true); return factory; } } ``` 4. **定义Trigger和JobDetail** 使用`@DisallowConcurrentExecution`和`@...

    Spring下使用Quartz任务调度

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setTriggers(myJobTrigger(myJob)); return factory; } } ``` 在上述代码中,`@EnableScheduling`注解开启了Spring的定时任务支持。 最后...

    spring设置动态定时任务.pdf

    通过正确配置`MethodInvokingJobDetailFactoryBean`、`CronTriggerBean`以及`SchedulerFactoryBean`,并结合业务接口动态更新Cron表达式,我们可以灵活地控制任务的执行。同时,确保并发控制和任务管理的安全性是...

    Spring任务调度demo

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setApplicationContext(context); return factory; } @Bean public JobDetail jobDetail() { return JobBuilder.newJob(MyJob.class) ...

    Springboot 整合Quartz

    SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setOverwriteExistingJobs(true); factory.setTriggers(new Trigger[]{myJobTrigger()}); return factory; } } ``` 在上述代码中,我们...

    spring quartz例子

    &lt;bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; * * * ?"/&gt; ``` 在上述配置中,`SchedulerFactoryBean`用于创建并启动Scheduler,`...

    spring定时器配置

    &lt;bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"&gt; ``` 或者,如果使用Java配置,可以这样写: ```java @Configuration @EnableScheduling public ...

Global site tag (gtag.js) - Google Analytics