1.原始做法: spring quartz配置文件,一个调度配置了两个bean,对于查找需要多查询一次
如下
<!-- ==================== 定时同步价格信息 ========================= -->
<bean id="priceTaskTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="priceTaskDetail" />
<property name="cronExpression" value="0 */12 * * * ?" />
</bean>
<bean id="priceTaskDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="masterMsgsProceedManage" />
<property name="targetMethod" value="processMqSkuPriceMsg" />
</bean>
缺点:查找以及bean数量
2.使用P标签及内部bean配置spring xml参数
<!-- ==================== 定时同步价格信息 ========================= -->
<bean id="priceTaskTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<bean p:targetObject-ref="masterMsgsProceedManage" p:targetMethod="processMqSkuPriceMsg" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" />
</property>
<property name="cronExpression" value="0 */12 * * * ?" />
</bean>