Spring定时任务传参问题 <property name="arguments"
<bean id="mayAckRedeemGiftJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="mayAckRedeemGiftJob"/> <!-- <property name="cronExpression" value="0 0 3 1 ? *"/> 每月1号3点 --> <property name="cronExpression" value="0 55 10 ? * *"/> <!-- 每天上午10.15触发 --> </bean> <bean id="mayAckRedeemGiftJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="mayAckRedeemGift"/> <property name="targetMethod" value="downloadRedeemGiftSFTP"/> <!-- 下载升级礼信息 --> <property name="concurrent" value="false"/>
单个参数 <property name="arguments" value="3"/>
多个参数
<property name="arguments"> <!-- list元素列出调用方法多个参数值 --> <list> <value>java.version</value> </list> </property>
</bean> <bean id="mayAckRedeemGift" class="com.winchannel.crm.oap.akc.schedule.CrmLorealAckDataJob "> <property name="crmAckLorealAppDataManager" ref="crmAckLorealAppDataManager"/> </bean>
获取:
public void downloadRedeemGiftSFTP(String args) { System.out.println(">>"+args); }
欢迎点评,共同学习,共同进步