以下是我配置的applicationContext-quartz.xml,但是cron表达式不执行,如果把3个任务的表达式修改成
<property name="cronExpression" value="10 0/1 * * * ?" /> 就会正常执行,不知道是哪里出了问题
<bean id="bizObject_1" class="com.cubynet.utils.AdApplyJobTask" />
<bean id="bizObject_2" class="com.cubynet.uitl.AfricanJobTask" />
<bean id="bizObject_3" class="com.cubynet.uitl.CompanyJobTask" />
<bean id="jobDetail_1" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="bizObject_1" />
<property name="targetMethod" value="doShowSpace" />
</bean>
<bean id="jobDetail_2" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="bizObject_2" />
<property name="targetMethod" value="doShow" />
</bean>
<bean id="jobDetail_3" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="bizObject_3" />
<property name="targetMethod" value="doShowCompany" />
</bean>
<bean id="cronTrigger_1" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail_1" />
<property name="cronExpression" value="0 0 0 * * ?" />
</bean>
<bean id="cronTrigger_2" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail_2" />
<property name="cronExpression" value="0 0 8,9,10,11 * * ?" />
</bean>
<bean id="cronTrigger_3" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail_3" />
<property name="cronExpression" value="0 0 8,9,10,11 * * ?" />
</bean>
<!-- 设置调度 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger_1" />
<ref bean="cronTrigger_2" />
<ref bean="cronTrigger_3" />
</list>
</property>
<property name="taskExecutor" ref="executor" />
</bean>
------解决方案--------------------
是报异常还是不执行呢,cron语法貌似没问题,每天8,9,10,11点运行,是不是还没到时间?
------解决方案--------------------
定时器2和3时间冲突了,不知道执行哪一个。
------解决方案--------------------
是冲突了,你可以那你机子上建立两个相同的任务计划,就明白了,在控制面板——》任务计划去建立!
------解决方案--------------------
标题写错,是quartz哦。。亲。
正解。